United States-English |
|
|
HP-UX Reference > Bbgets(3G)HP-UX 11i Version 3: February 2007 |
|
NAMEbgets() — read stream up to next delimiter SYNOPSIS#include <libgen.h> char *bgets( char *buffer, size_t *count, FILE *stream, const char *breakstring ); DESCRIPTIONbgets reads characters from stream into buffer until either count is exhausted or one of the characters in breakstring is encountered in the stream. The read data is terminated with a null byte (\0) and a pointer to the trailing null is returned. If a breakstring character is encountered, the last nonnull is the delimiter character that terminated the scan. 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. To use this interface, link in the libgen library by specifying -lgen. For example: cc foo.c -lgen RETURN VALUENULL is returned on error or end-of-file. Reporting the condition is delayed to the next call if any characters were read but not yet returned. |
Printable version | ||
|