Mail Archives: djgpp/1998/01/01/11:19:19
On Thu, 1 Jan 1998, Noam Rotem wrote:
> >What's wrong with `getc'? It can read single characters as well, if
> >you switch stdin to binary mode (use `setmode') and make it unbuffered
> >(use `setvbuf'). Did you try it?
>
> I can't use 'setmode' under UNIX. This is what's wrong with it...
Then surround the call to `setmode' with #ifdef __MSDOS__ ... #endif.
Unix doesn't need the call at all, so it will work on Unix also.
> Is there any other way to do it (using ANSI C / stdio.h)?
ANSI C doesn't specify a way that would guarantee to return one character
at a time. Sorry, this is one of the cases where some OS dependence is
necessary.
- Raw text -