Hey all!
I need to create a FILE* input stream in plain C, which reads from a memory buffer (char*) as if it were from standard input. I want be able to create
such a stream and read it with fgetc(), fscanf(), fread() or what ever stream based input function in the standard C library. Something similar to the StrStream class in C++ or the StringReader class in Java, but I want a plain C solution. It must be transparent to the user if the file pointer takes data from a file, socket, pipe or memory buffer!
It have to work in UNIX! I'm not interested in a
Win32 exclusive solution.
Is it possible at all? But in fact Java and C++ implements it so I think there must be a workaround. Otherwise there wouldn't be any StrStreams and StringReaders!