home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / stdio / fgets.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-27  |  534 b   |  35 lines

  1. #include <stdio.h>
  2. #include <errno.h>
  3.  
  4. #include <dos/dosextens.h>
  5. #include <proto/dos.h>
  6.  
  7. /************************************************************************/
  8.  
  9. char *fgets(char *String, size_t Length, FILE *Stream)
  10.  
  11. {
  12.   char *Result;
  13.  
  14.   if (DOSBase->dl_lib.lib_Version<39)
  15.     {
  16.       Length--;
  17.     }
  18.   Result=FGets(fileno(Stream),String,Length);
  19.   if (!Result)
  20.     {
  21.       long Error;
  22.  
  23.       if ((Error=IoErr()))
  24.     {
  25.       errno=Error;
  26.       Stream->Flags.Error=1;
  27.     }
  28.       else
  29.     {
  30.       Stream->Flags.Eof=1;
  31.     }
  32.     }
  33.   return Result;
  34. }
  35.