*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> bgets (3g)              
Title
Content
Arch
Section
 

Contents


bgets(3G)							     bgets(3G)


NAME    [Toc]    [Back]

     bgets - read stream up to next delimiter

SYNOPSIS    [Toc]    [Back]

     cc	[flag ...] file	... -lgen [library ...]

     #include <libgen.h>

     char *bgets (char *buffer<b>,	size_t count<b>, FILE *stream<b>,
	  const	char *breakstring<b>);

DESCRIPTION    [Toc]    [Back]

     bgets 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 non-null 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.

EXAMPLES    [Toc]    [Back]

     #include  <libgen.h>

     char buffer[8];
     /*	read in	first user name	from /etc/passwd */
     fp	= fopen("/etc/passwd","r");
     bgets(buffer, 8, fp, ":");

DIAGNOSTICS    [Toc]    [Back]

     NULL 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.

SEE ALSO    [Toc]    [Back]

      
      
     gets(3S)


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
clQueryScheme IRIX Determine the scheme and read the stream header
fgetwc Linux read a wide character from a FILE stream
fgetws Linux read a wide character string from a FILE stream
tis_read_unlock Tru64 Unlocks a read-write lock that was acquired for read access
tis_read_lock Tru64 Acquires a read-write lock for read access
pthread_rwlock_rdlock Tru64 Acquires a read-write lock for read access
AFreadmisc IRIX read from / write to / move logical read/write pointer for data in a miscellaneous chunk in an audio file
tis_read_trylock Tru64 Attempts to acquire a read-write lock for read access and does not wait if the lock cannot be immedi...
readdir Linux read a directory
preadv OpenBSD read input
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service