home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / IO / FSETMODE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  445 b   |  25 lines

  1. /* fsetmode.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <stdio.h>
  4. #include <io.h>
  5. #include <errno.h>
  6. #include <fcntl.h>
  7.  
  8. int _fsetmode (FILE *stream, const char *mode)
  9. {
  10.   int i;
  11.  
  12.   if (*mode == 'b')
  13.     i = O_BINARY;
  14.   else if (*mode == 't')
  15.     i = O_TEXT;
  16.   else
  17.     {
  18.       errno = EINVAL;
  19.       return (-1);
  20.     }
  21.   if (setmode (fileno (stream), i) == -1)
  22.     return (-1);
  23.   return (0);
  24. }
  25.