From: "Bonifati" Newsgroups: comp.os.msdos.djgpp Subject: open console into binary mode ? Date: Sun, 26 Sep 1999 18:00:46 +0200 Organization: Centro Servizi Interbusiness Lines: 40 Message-ID: <7slfup$m1f$1@fe2.cs.interbusiness.it> NNTP-Posting-Host: 212.210.156.13 X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com i have to write some filter programs which must work for binary files, not only for text ones. i tried to open console into binary mode, but my program crashes when the input isn't redirect from a file. here an example: test.c ------- #include #include main() { char s[100]; fflush(stdin); setmode(fileno(stdin), O_BINARY); gets(s); puts(s); } C:\> test < infile ok! it displays it's first line C:\> test the program hangs! nothing appears if i press some keys and CTRL-Break doesn't work! i tried to add the line setmode(fileno(stdout), O_BINARY); but the program continues to crash if invoked without redirection