setbuf. McGraw-Hill The Complete Reference Fourth Edition
বিজ্ঞাপন
বিজ্ঞাপন
C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s
719
%[A-Z]
One important point to remember is that the scanset is case sensitive. Therefore, if you want to scan for both upper- and lowercase letters, they must be specified individually.
The scanf( ) function returns a number equal to the number of fields that were successfully assigned values. This number will not include fields that were read but not assigned because the * modifier was used to suppress the assignment. EOF is returned if an error occurs before the first field is assigned.
Related functions are printf( ) and fscanf( ).
setbuf
#include <cstdio> void setbuf(FILE * stream, char *buf);
The setbuf( ) function is used either to specify the buffer that stream will use or, if called with buf set to null, to turn off buffering. If a programmer-defined buffer is to be specified, it must be BUFSIZ characters long. BUFSIZ is defined in <cstdio>.
The setbuf( ) function returns no value.
Related functions are fopen( ), fclose( ), and setvbuf( ).
setvbuf
#include <cstdio> int setvbuf(FILE * stream, char *buf, int mode, size_t size);
The setvbuf( ) function allows the programmer to specify the buffer, its size, and its mode for the specified stream. The character array pointed to by buf is used as the stream buffer for I/O operations. The size of the buffer is set by size, and mode determines how buffering will be handled. If buf is null, setvbuf( ) will allocate its own buffer.
The legal values of mode are _IOFBF, _IONBF, and _IOLBF. These are defined in
<cstdio>
. When mode is set to _IOFBF, full buffering will take place. If mode is _IOLBF, the stream will be line buffered, which means that the buffer will be flushed each time a newline character is written for output streams; for input streams, input is buffered until a newline character is read. If mode is _IONBF, no buffering takes place.
ডাউনলোড
বিজ্ঞাপন