delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/01/11:19:19

Date: Thu, 1 Jan 1998 18:18:55 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Noam Rotem <nrotem AT johnbryce DOT co DOT il>
cc: djgpp AT delorie DOT com
Subject: Re: Escape Sequences / Reading from Console
In-Reply-To: <Chameleon.980101155719.nrotem@netvision.netvision>
Message-ID: <Pine.SUN.3.91.980101181612.7030A-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019