|
|
cc [ flag ... ] file ... -lgen [ library ... ]
#include <libgen.h>
char *bgets(char *buffer, size_t *count, FILE *stream, const char *breakstring);
MT-Safe
Note that, except for the fact that the returned value points to the end of the read string rather than to the beginning, the call
bgets(buffer, sizeof buffer, stream, "\n");
is identical to
fgets (buffer, sizeof buffer, stream);
There is always enough room reserved in the buffer for the trailing null.
If breakstring is a null pointer, the value of breakstring from the previous call is used. If breakstring is null at the first call, no characters will be used to delimit the string.
#include <libgen.h>
char buffer[8];
/* read in first user name from /etc/passwd */
fp = fopen("/etc/passwd","r");
bgets(buffer, 8, fp, ":");
When compiling multi-thread applications, the _REENTRANT flag must be defined on the compile line. This flag should only be used in multi-thread applications.
|
|
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97