Sponsored Content
Full Discussion: stdio.h vs unistd.h I/O
Top Forums Programming stdio.h vs unistd.h I/O Post 302453080 by majid.merkava on Tuesday 14th of September 2010 03:58:21 AM
Old 09-14-2010
so for which applications it is good to use buffered I/O and for which it is better to use unbuffered I/O?
 

6 More Discussions You Might Find Interesting

1. Programming

Atomic Read and Write with stdio

hi guys. can we use fread and fwrite with pipes to write data more than PIPE_BUF atomically since they lock FILE object until I/O operation finish? (1 Reply)
Discussion started by: majid.merkava
1 Replies

2. Programming

FILE structure - stdio.h

Hi All, I am new to linux and Programming. Inside the file stdio.h, there is a description about FILE structure. Which has many internal data members like _p, _r, _flags etc. I have written a sample code to find out the contents of the FILE structure. It opens a sample file ( FILE *fp ),... (5 Replies)
Discussion started by: nikunjbadjatya
5 Replies

3. Programming

stdio.h not found on Solaris 11

Hi friends, I hope u r doing well. I have just installed Solaris 11, and it seems that solaris 11 doesn't come with all the packages, one has to do everything manually. I download gcc from sunfreeware.com and installed it. After setting up the path variable, I tried to compile the hello world... (4 Replies)
Discussion started by: gabam
4 Replies

4. Solaris

fatal error: stdio.h: No such file or directory

Trying to compile a C program recievin this hello.c:1:19: fatal error: stdio.h: No such file or directory gcc is installed on the system. echo $PATH /usr/bin:/usr/sbin:/usr/gcc/4.5/include/c++/4.5.2/tr1 root@Sol11swtb01:/media/NO NAME/Programming/C/Testing# cd... (2 Replies)
Discussion started by: Fingerz
2 Replies

5. Programming

Ignoring the stdio.h file in a C file

I am facing a problem in the below given code. int main() { printf("\nHello Geeks\n\n") ; return 0 ; } In the above mentioned code i left including "#include ". And if i compile and execute this piece of code, the output is printed as expected. But "#include " being the most important... (7 Replies)
Discussion started by: Raj 89
7 Replies

6. Programming

C++ : is what the meaning of #include<stdio.h>?

Hello Guys, I'm new in programing line & just started from C++ programs but i don't know the meaning of #include<stdio.h> file....Guys tell me what's the working of this file in C++ program?? I'm confused... Title changed: Please use a descriptive subject text, and not C++?? (3 Replies)
Discussion started by: ggiwebsinfo
3 Replies
setbuffer(3C)						   Standard C Library Functions 					     setbuffer(3C)

NAME
setbuffer, setlinebuf - assign buffering to a stream SYNOPSIS
#include <stdio.h> void setbuffer(FILE *iop, char *abuf, size_t asize); int setlinebuf(FILE *iop); DESCRIPTION
The setbuffer() and setlinebuf() functions assign buffering to a stream. The three types of buffering available are unbuffered, block buffered, and line buffered. When an output stream is unbuffered, information appears on the destination file or terminal as soon as writ- ten; when it is block buffered, many characters are saved and written as a block; when it is line buffered, characters are saved until either a NEWLINE is encountered or input is read from stdin. The fflush(3C) function may be used to force the block out early. Normally all files are block buffered. A buffer is obtained from malloc(3C) upon the first getc(3C) or putc(3C) performed on the file. If the standard stream stdout refers to a terminal, it is line buffered. The standard stream stderr is unbuffered by default. The setbuffer() function can be used after a stream iop has been opened but before it is read or written. It uses the character array abuf whose size is determined by the asize argument instead of an automatically allocated buffer. If abuf is the null pointer, input/output will be completely unbuffered. A manifest constant BUFSIZ, defined in the <stdio.h> header, tells how large an array is needed: char buf[BUFSIZ]; The setlinebuf() function is used to change the buffering on a stream from block buffered or unbuffered to line buffered. Unlike set- buffer(), it can be used at any time that the stream iop is active. A stream can be changed from unbuffered or line buffered to block buffered by using freopen(3C). A stream can be changed from block buffered or line buffered to unbuffered by using freopen(3C) followed by setbuf(3C) with a buffer argument of NULL. RETURN VALUES
The setlinebuf() function returns no useful value. SEE ALSO
malloc(3C), fclose(3C), fopen(3C), fread(3C), getc(3C), printf(3C), putc(3C), puts(3C), setbuf(3C), setvbuf(3C) NOTES
A common source of error is allocating buffer space as an "automatic" variable in a code block, and then failing to close the stream in the same block. SunOS 5.10 13 May 1997 setbuffer(3C)
All times are GMT -4. The time now is 04:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy