Pipe is in text-mode?

This is a discussion on Pipe is in text-mode? within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I'm having more troubles with win32 pipes, this is what I'm doing: Creating a pipe for a child process's ...

  1. #1
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459

    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.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    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

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    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?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM
  3. Removing text between /* */ in a file
    By 0rion in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 09:54 AM
  4. Small HTML question
    By Thantos in forum Tech Board
    Replies: 4
    Last Post: 12-29-2003, 12:37 AM
  5. Text Mode to more than 25 lines
    By karsch1 in forum C Programming
    Replies: 3
    Last Post: 08-31-2001, 02:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21