TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: MAS 76336,3226 (X)
from: Mark Wuest 74030,332
date: 1990-11-20 10:00:04
subject: #8339-C programming

#: 8348 S3/Languages
    20-Nov-90  10:00:04
Sb: #8339-C programming
Fm: Mark Wuest 74030,332
To: MAS 76336,3226 (X)

Robert,
 Here's a quick-and-dirty routine to get one byte from a path you have
previously opened with open() (or use path = 0 for stdin).
 cread(path,buf)
 int path;
 char *buf;
 {
      int cnt;
 
      if((cnt = _gs_rdy(path)) < 0)
           return(cnt);
      if(cnt == 0)
           return(cnt);
      return(read(path,buf,1);
 }
 
 This should read just one byte. If there is nothing there, it returns 0.
Obviously if there is an error, it returns -1. Hope this is a good starting
place for you.
 Mark

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.