-
Pipe is in text-mode?
Hello,
I'm having more troubles with win32 pipes, this is what I'm doing:
- Creating a pipe for a child process's stdout
- Launching the child process with the stdout pipe inherited (to the parent)
- Reading from the pipe (using ReadFile), ie the child process's stdout and writing it to a socket
However, it seems that the data I read from the pipe is in text-mode? eg LF is translated into CRLF. I'm unsure if it's being converted on the child process, or the parent process - I guess the parent. So how do I read it in binary mode? I've search MSDN & IRC for hours :(
This is the source: http://pastebin.com/m2409ff53 the area in which I read from the pipe is highlighted.
Thanks in advance.
-
It is the C library functions that do character translation before writing to the OS stdout handle.
You can change stdout to use binary mode to avoid character translation.
http://msdn2.microsoft.com/en-us/lib...f8(VS.80).aspx
http://www.mingw.org/MinGWiki/index.php/binary
-
Yeah, I gathered that. Just I was wondering how a webserver would work with CGI? Unless it's in text-mode anyway? Can't I force the inherited handle to be in binary-mode or something?