Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

stream_set_write_buffer(3) [php man page]

STREAM_SET_WRITE_BUFFER(3)						 1						STREAM_SET_WRITE_BUFFER(3)

stream_set_write_buffer - Sets write file buffering on the given stream

SYNOPSIS
int stream_set_write_buffer (resource $stream, int $buffer) DESCRIPTION
Sets the buffering for write operations on the given $stream to $buffer bytes. Output using fwrite(3) is normally buffered at 8K. This means that if there are two processes wanting to write to the same output stream (a file), each is paused after 8K of data to allow the other to write. PARAMETERS
o $stream - The file pointer. o $buffer - The number of bytes to buffer. If $buffer is 0 then write operations are unbuffered. This ensures that all writes with fwrite(3) are completed before other processes are allowed to write to that output stream. RETURN VALUES
Returns 0 on success, or EOF if the request cannot be honored. EXAMPLES
Example #1 stream_set_write_buffer(3) example The following example demonstrates how to use stream_set_write_buffer(3) to create an unbuffered stream. <?php $fp = fopen($file, "w"); if ($fp) { stream_set_write_buffer($fp, 0); fwrite($fp, $output); fclose($fp); } ?> SEE ALSO
fopen(3), fwrite(3). PHP Documentation Group STREAM_SET_WRITE_BUFFER(3)

Check Out this Related Man Page

fwrite(3C)						   Standard C Library Functions 						fwrite(3C)

NAME
fwrite - binary output SYNOPSIS
#include <stdio.h> size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream); DESCRIPTION
The fwrite() function writes, from the array pointed to by ptr, up to nitems elements whose size is specified by size, to the stream pointed to by stream. For each object, size calls are made to the fputc(3C) function, taking the values (in order) from an array of unsigned char exactly overlaying the object. The file-position indicator for the stream (if defined) is advanced by the number of bytes successfully written. If an error occurs, the resulting value of the file-position indicator for the stream is unspecified. The st_ctime and st_mtime fields of the file will be marked for update between the successful execution of fwrite() and the next successful completion of a call to fflush(3C) or fclose(3C) on the same stream or a call to exit(2) or abort(3C). RETURN VALUES
The fwrite() function returns the number of elements successfully written, which might be less than nitems if a write error is encountered. If size or nitems is 0, fwrite() returns 0 and the state of the stream remains unchanged. Otherwise, if a write error occurs, the error indicator for the stream is set and errno is set to indicate the error. ERRORS
Refer to fputc(3C). USAGE
Because of possible differences in element length and byte ordering, files written using fwrite() are application-dependent, and possibly cannot be read using fread(3C) by a different application or by the same application on a different processor. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
write(2), fclose(3C), ferror(3C), fopen(3C), fread(3C), getc(3C), gets(3C), printf(3C), putc(3C), puts(3C), attributes(5), standards(5) SunOS 5.11 24 Jul 2002 fwrite(3C)
Man Page

4 More Discussions You Might Find Interesting

1. Programming

Help -fwrite consuming lot of memory !!!

Hi , I am running a C/C++ program on a solaris 5.8 machine. This parituclar application has a module which saves data to a file. The module uses fwrite() function to save data. The fwrite function write about 500 MB of data to a file. The problem which I am facing is, the memory consumtion... (2 Replies)
Discussion started by: ajphaj
2 Replies

2. Programming

fwrite in Linux and UNIX

Hi I have an fwrite function in my C++ application. It is able to create the files in HP-UX. cross is one structure rec2 is another structure within cross. fwrite_return = fwrite( &cross.rec2, sizeof(cross.rec2), ... (14 Replies)
Discussion started by: rkraj
14 Replies

3. Programming

fopen and open

what is the difference between fopen and open fread and read fwrite and write open and create why this much of functions for the i/o when everything does the same...? What is their major difference? In which case, which is the best to use. :confused:'ed Collins (2 Replies)
Discussion started by: collins
2 Replies

4. Programming

The fwrite function is not returning error, if the file was removed.

The fwrite function call is not returning error, when the file it writes to is removed, please advise on how to find if the file already opened and being written by a program is removed manually or by some other process. please see the code below, #include<stdio.h> #include<stdlib.h> ... (3 Replies)
Discussion started by: Kesavan
3 Replies