예제 #1
0
int altFclose(ALT_FILE *fp) {
   int closeOK;
   
   if (fp->fd < 0)
      return EOF;
      
   altFflush(fp);
   closeOK = close(fp->fd);
   fp->fd = -1;
   return closeOK == 0 ? 0 : EOF;
}
예제 #2
0
int altPutc(char c, ALT_FILE *fp) {
   *fp->next++ = c;
   if (fp->next == fp->buffer + fp->bufSize)
      altFflush(fp);
}
예제 #3
0
int altGetc(ALT_FILE *fp) {
   if (fp->next == fp->buffer + fp->bufSize)
      altFflush(fp);
	  
   return fp->flags & FILE_ATEOF ? EOF : *fp->next++;
}