2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 ANSI C function fgets().
10 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
16 /*****************************************************************************
29 Read one line of characters from the stream into the buffer.
30 Reading will stop, when a newline ('\n') is encountered, EOF
31 or when the buffer is full. If a newline is read, then it is
32 put into the buffer. The last character in the buffer is always
33 '\0' (Therefore at most size-1 characters can be read in one go).
36 buffer - Write characters into this buffer
37 size - This is the size of the buffer in characters.
38 stream - Read from this stream
41 buffer or NULL in case of an error or EOF.
46 // Read a file line by line
50 while (fgets (line, sizeof (line), fh))
58 fopen(), gets(), fputs(), putc()
62 ******************************************************************************/
64 fdesc
*fdesc
= __getfdesc(stream
->fd
);
69 stream
->flags
|= _STDIO_ERROR
;
74 buffer
= FGets ((BPTR
)fdesc
->fcb
->fh
, buffer
, size
);
80 errno
= IoErr2errno(IoErr());
81 stream
->flags
|= _STDIO_ERROR
;
85 stream
->flags
|= _STDIO_EOF
;