Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/setbuf.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/setbuf.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/setbuf.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/setbuf.html on line 8
Associate a buffer with a stream
#include <stdio.h>
void setbuf( FILE *fp,
char *buffer );
- fp
- The stream that you want to associate with a buffer.
- buffer
- NULL, or a pointer to the buffer; see below.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The setbuf() function associates the supplied buffer
with the stream specified by fp.
If you want to call setbuf(), you must call it
after opening the stream, but before doing any reading, writing,
or seeking.
If buffer is NULL, all
input/output for the stream is completely unbuffered.
If buffer isn't NULL,
then it must point to an array that's at least BUFSIZ
characters long, and all input/output is fully buffered.
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
char *buffer;
FILE *fp;
buffer = (char *)malloc( BUFSIZ );
if( buffer == NULL ) {
return EXIT_FAILURE;
}
fp = fopen( "some_file", "r" );
setbuf( fp, buffer );
/* . */
/* . */
/* . */
fclose( fp );
free( buffer );
return EXIT_SUCCESS;
}
ANSI,
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
fopen(),
setvbuf()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/setbuf.html on line 151
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/setbuf.html on line 151