istream

How to convert BYTE* into a gdi+ image object?

I want to convert a BYTE* into an gdi+ Image object. How can I do this? The BYTE* seems a Dib point. I found Image has a method named Image::FromStream() which may help, But I can not find any reference about how to convert a BYTE* into a IStream object. How can I do this? Thanks in advance! Actually, it is hard to believe MS provide...

Append data to an IStream object

Hi I am making calls to a web service to get data from my dll. I am getting the data in a char* object in parts. I want to get the whole data into an IStream object. I am running a while loop and getting the data into char* object. Can someone please tell me how I can combine all this data into a single IStream or LPSTREAM object. Tha...

Getting an IntPtr to a ulong variable in C#

I need to pass an IntPtr to IStream.Read, and the IntPtr should point to a ulong variable. How do I get this IntPtr that points to my ulong variable? ...

How do I use MySQL C++ Connector for storing binary data?

I have a block of binary data defined as: void* address, size_t binarySize; that I want to store to a MySQL database using MySQL C++ Connector. The function setBlob() takes istream. The question: How can I convert from a raw void* address, size_t binarySize to either an istream object or istringstream? Is it possible to do this with...

Drag and drop from C# to Windows Explorer with IStorage/IStream

I've been working on what sounds like simple functionality for way too long now. The idea is that I have an application with a TreeView. This treeview represents contents of a database organized into files and folders, much like Windows Explorer. So it makes sense that the user should be able to drag those files/folders out of my app ...

How can I read from an std::istream (using operator>>)?

How can I read from an std::istream using operator>>? I tried the following: void foo(const std::istream& in) { std::string tmp; while(in >> tmp) { std::cout << tmp; } } But it gives an error: error: no match for 'operator>>' in 'in >> tmp' ...

what is the result of incrementing an istream_iterator which is already at the end of the stream?

I've looked at the standard and didn't see an obvious answer. suppose i've done this: std::istream_iterator<char> is(file); while(is != std::istream_iterator<char>()) { ++is; } now is is at the end of the stream and is equal to std::istream_iterator<char>(). What happens if I increment it one more time? Is it still equal to std::...

How to store an IStream to a file via C#?

I'm working with a 3rd party component that returns an IStream object (System.Runtime.InteropServices.ComTypes.IStream). I need to take the data in that IStream and write it to a file. I've managed to get that done, but I'm not really happy with the code. With "strm" being my IStream, here's my test code... // access the structure co...

istream get method behavior

I read istream::get and a doubt still hangs. Let's say my delimiter is actually the NULL '\0' character, what happens in this case? From what I read: If the delimiting character is found, it is not extracted from the input sequence and remains as the next character to be extracted. Use getline if you want this character to be extracte...

FILE * and istream: connect the two?

Suppose I "popen" an executable, I get a FILE* in return. Furthermore, suppose I'd like to "connect" this file to an istream object for easier processing, is there a way to do this? ...

Overloading operator>> to a char buffer in C++ - can I tell the stream length?

I'm on a custom C++ crash course. I've known the basics for many years, but I'm currently trying to refresh my memory and learn more. To that end, as my second task (after writing a stack class based on linked lists), I'm writing my own string class. It's gone pretty smoothly until now; I want to overload operator>> that I can do stuff ...

How to check if there is anything in cin [C++]

Hi, is there any way to check if there is something in cin? I tryied peek() but if there isn't anything peek() waits for input and that isn't what I want. Thank you ...

C# and IStream.Read

Hi All, I'm trying to use System.Runtime.InteropServices.ComTypes.IStream from C#, but I'm having some trouble. According to MSDN, the C# definition looks like this: void Read( byte[] pv, int cb, IntPtr pcbRead ) Basically, I can read data from the stream, but the above "pcbRead" value is always "0" (even though the byte...

Reading SDL_RWops from a std::istream

I'm quite surprised that Google didn't find a solution. I'm searching for a solution that allows SDL_RWops to be used with std::istream. SDL_RWops is the alternative mechanism for reading/writing data in SDL. Any links to sites that tackle the problem? An obvious solution would be to pre-read enough data to memory and then use SDL_RWF...

declaring generic istream in c++

I need to write a program that reads in either from ifstream or cin, depending on parameters passed into the program at runtime. I was planning on doing the following: istream in; if(argv[1] == "cin") { in = cin; } else { ifStream inFile; inFile.open(argv[1].c_str()); in = inFile; } However, istream in...

Is it possible to treat datatypes as an input stream?

int main(int argc, char *argv[]) { Move move; ifstream inf("eof.txt"); inf >> move; return 0; } istream& operator>> (istream &is, Move &move) { is >> move.c; // c = char c[2]; cout << move.c << endl; return is; } eof.txt has lines of 2 chars, so if it had "9r", "9r" would be stored in move's data member (I made it publi...

Input stream iterators and exceptions

I was playing around with istream iterators and exception handling a few days ago and I came across with this curiousity: #include <iostream> #include <fstream> #include <iterator> #include <algorithm> using namespace std; int main(int argc, char* argv[]) { if (argc < 2) { cout << argv[0] << " <file>" << endl; return -1...

Read from cin or a file

When I try to compile the code istream in; if (argc==1) in=cin; else { ifstream ifn(argv[1]); in=ifn; } gcc fails, complaining that operator= is private. Is there any way to set an istream to different values based on a condition? ...

Using C++ filestreams (fstream), how can you determine the size of a file?

I'm sure I've just missed this in the manual, but how do you determine the size of a file (in bytes) using C++'s istream class from the fstream header? ...

How could I redirect stdin (istream) in wxWidgets?

Hi, I'm trying to figure out how to redirect istream to wxwidgets. I was able to accomplish redirecting ostream, here's how (so you know what I mean): wxTextCtrl* stdoutctrl = new wxTextCtrl(...); wxStreamToTextRedirector redirect(stdoutctrl); //Redirect ostream std::cout<<"stdout -- does this work?"<<std::endl; //It worked. I'...