-----------------------------------------------------------

New Message on cochindotnet

-----------------------------------------------------------
From: mail2dolly
Message 4 in Discussion

Hi,

I am now using ReadFile in a loop to read stdin, It works fine for small amounts of 
data but when the data piped is large, it crashes saying "The Process tried to write 
to a nonexistent pipe" ( For Eg dir /s|prog.exe on the C drive at cmd)

Any idea how I can get past this? 
Ignorant question : Can I use anonymous pipe concept here to read in from the pipe. Or 
that is used only with user created pipes?

I am doing something like this :

if(GetFileType(h) == FILE_TYPE_PIPE)
        {
                while(1)
                {
                        buf = new char[length];
                        bResult = ReadFile(h, buf, length,  NULL);
                        
                        buf[bytesRead] = '\0';
                        if(bResult &  bytesRead == 0 )  break; //EOF
                        buf = 0;
                        bytesRead = 0;
                }
        }

ReadFile throws an error sometimes, and sometimes it works fine.         I think I am 
missing something here, if somebody has any idea, please mail back.

Thanks and Regards,
Dolly

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/cochindotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to