Original Post
Hi, i''m writing a CGI program to uplaod files, and i''m having a bit of difficulty. Since the parameters (including the file) are passed to the CGI program through stdin, stdin contains non-ASCII characters. This causes fread(), fgets(), etc to fail when they start reading non-ASCII characters.
Does anyone know how i can get binary input in stdin?
I''ve tried freopen("Blah.txt","rb",stdin) which just doesn''t work (not really that supprising) and fdopen(fileno(stdin),"rb") which still doesn''t take non-ASCII characters - it doesn''t seem to work at all with stdin or normal files
I know this is the problem because if i put all my data (including the CGI headers) into a file and use that instead of stdin, it works perfectly (if i open the file with "rb").
Obviously this is pointless though, since i need to get the data before i can put it into a file with the CGI headers to get the data from :s
Soo... back to the question: How can i get binary input through stdin?
Cheers,
Steve
Steve
DirectX Programmer
Soon to be the new Bill Gates
DirectX Programmer
Soon to be the new Bill Gates