偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

setlinebuf 中文man頁面

系統(tǒng)
有三種類型的緩沖策略,它們是無緩沖,塊緩沖和行緩沖。當輸出流無緩沖時,信息在寫的同時出現(xiàn)于目標文件或終端上;當是塊緩沖時,字符被暫存,然后一起寫入;當是行緩沖時,字符被暫存,直到要輸出一個新行符,或者從任何與終端設備連接的流中 (典型的是 stdin) 讀取輸入時才輸出。函數(shù) fflush(3) 可以用來強制提前輸出。(參見 fclose(3)) 通常所有文件都是塊緩沖的。當文件 I/O 操作在文件上發(fā)生時,將調(diào)用 malloc(3) ,獲得一個緩沖。如果流指向一個終端 (通常 stdout 都是這樣),那么它是行緩沖的。標準錯誤流 stderr 默認總是無緩沖

NAME

setbuf, setbuffer, setlinebuf, setvbuf - 流緩沖操作  

SYNOPSIS 總覽

#include <stdio.h>

void setbuf(FILE *stream, char *buf);
void setbuffer(FILE *stream, char *buf, size_t size);
void setlinebuf(FILE *stream);
int setvbuf(FILE *stream, char *buf, int mode , size_t size);  

DESCRIPTION 描述

有三種類型的緩沖策略,它們是無緩沖,塊緩沖和行緩沖。當輸出流無緩沖時,信息在寫的同時出現(xiàn)于目標文件或終端上;當是塊緩沖時,字符被暫存,然后一起寫入;當是行緩沖時,字符被暫存,直到要輸出一個新行符,或者從任何與終端設備連接的流中 (典型的是 stdin) 讀取輸入時才輸出。函數(shù) fflush(3) 可以用來強制提前輸出。(參見 fclose(3)) 通常所有文件都是塊緩沖的。當文件 I/O 操作在文件上發(fā)生時,將調(diào)用 malloc(3) ,獲得一個緩沖。如果流指向一個終端 (通常 stdout 都是這樣),那么它是行緩沖的。標準錯誤流 stderr 默認總是無緩沖的。

函數(shù) setvbuf 可以用在任何打開的流上,改變它的緩沖。參數(shù) mode 必須是下列三個宏之一:

_IONBF
無緩沖
_IOLBF
行緩沖
_IOFBF
完全緩沖

除非是無緩沖的文件,否則參數(shù) buf 應當指向一個長度至少為 size 字節(jié)的緩沖;這個緩沖將取代當前的緩沖。如果參數(shù) bufNULL ,只有這個模式會受到影響;下次 read 或 write 操作還將分配一個新的緩沖。函數(shù) setvbuf 只能在打開一個流,還未對它進行任何其他操作之前使用。

其他三個函數(shù)調(diào)用是函數(shù) setvbuf 的別名,函數(shù) setbuf 與使用下列語句完全等價:

setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);

函數(shù) setbuffer 與此相同,但是緩沖的長度由用戶決定,而不是由默認值 BUFSIZ 決定。函數(shù) setlinebuf 與使用下列語句完全等價:

setvbuf(stream, (char *)NULL, _IOLBF, 0);

RETURN VALUE 返回值

函數(shù) setvbuf 成功執(zhí)行時返回 0。它失敗時可能返回任何值,但是當 It can return any value on failure, but returns nonzero when mode 不正確,或者不能實現(xiàn)請求時,必須返回非零值。它在失敗時可能設置 errno 。其他函數(shù)沒有返回值。  

CONFORMING TO 標準參考

函數(shù) setbufsetvbuf 遵循 ANSI X3.159-1989 (``ANSI C'') 標準。  

BUGS

函數(shù) setbuffersetlinebuf 無法移植到 4.2BSD 之前的 BSD 版本,在 Linux 中僅在 libc 4.5.21 之后的系統(tǒng)中可用。在 4.2BSD 和 4.3BSD 系統(tǒng)中, setbuf 總是使用非最優(yōu)的緩沖大小,應當避免使用它。 在 stream 被關閉時,必須確保 buf 和它指向的空間仍然存在。這通常發(fā)生在程序終止時。 例如,下列調(diào)用是非法的:

#include <stdio.h>
int main()
{
    char buf[BUFSIZ];
    setbuf(stdin, buf);
    printf("Hello, world!\n");
    return 0;
}

SEE ALSO 參見

fclose(3), fflush(3), fopen(3), fread(3), malloc(3), printf(3), puts(3)

#p#

NAME

setbuf, setbuffer, setlinebuf, setvbuf - stream buffering operations  

SYNOPSIS

#include <stdio.h>

void setbuf(FILE *stream, char *buf);
void setbuffer(FILE *stream, char *buf, size_t size);
void setlinebuf(FILE *stream);
int setvbuf(FILE *stream, char *buf, int mode , size_t size);  

DESCRIPTION

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 written; when it is block buffered many characters are saved up and written as a block; when it is line buffered characters are saved up until a newline is output or input is read from any stream attached to a terminal device (typically stdin). The function fflush(3) may be used to force the block out early. (See fclose(3).) Normally all files are block buffered. When the first I/O operation occurs on a file, malloc(3) is called, and a buffer is obtained. If a stream refers to a terminal (as stdout normally does) it is line buffered. The standard error stream stderr is always unbuffered by default.

The setvbuf function may be used on any open stream to change its buffer. The mode parameter must be one of the following three macros:

_IONBF
unbuffered
_IOLBF
line buffered
_IOFBF
fully buffered

Except for unbuffered files, the buf argument should point to a buffer at least size bytes long; this buffer will be used instead of the current buffer. If the argument buf is NULL, only the mode is affected; a new buffer will be allocated on the next read or write operation. The setvbuf function may only be used after opening a stream and before any other operations have been performed on it.

The other three calls are, in effect, simply aliases for calls to setvbuf. The setbuf function is exactly equivalent to the call

setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);

The setbuffer function is the same, except that the size of the buffer is up to the caller, rather than being determined by the default BUFSIZ. The setlinebuf function is exactly equivalent to the call:

setvbuf(stream, (char *)NULL, _IOLBF, 0);

RETURN VALUE

The function setvbuf returns 0 on success. It can return any value on failure, but returns nonzero when mode is invalid or the request cannot be honoured. It may set errno on failure. The other functions are void.  

CONFORMING TO

The setbuf and setvbuf functions conform to ANSI X3.159-1989 (``ANSI C'').  

BUGS

The setbuffer and setlinebuf functions are not portable to versions of BSD before 4.2BSD, and are available under Linux since libc 4.5.21. On 4.2BSD and 4.3BSD systems, setbuf always uses a suboptimal buffer size and should be avoided. You must make sure that both buf and the space it points to still exist by the time stream is closed, which also happens at program termination. For example, the following is illegal:

#include <stdio.h>
int main()
{
    char buf[BUFSIZ];
    setbuf(stdin, buf);
    printf("Hello, world!\n");
    return 0;
}

SEE ALSO

fclose(3), fflush(3), fopen(3), fread(3), malloc(3), printf(3), puts(3)

責任編輯:韓亞珊 來源: CMPP.net
相關推薦

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-15 13:59:34

stty中文man

2011-08-22 10:14:05

crontab中文man

2011-08-24 15:08:18

EXECUTE中文man

2011-08-25 18:22:06

tcsetattr中文man

2011-08-12 09:23:11

diff中文man

2011-08-25 09:07:16

suffixes中文man

2011-08-25 10:43:13

protocols中文man

2011-09-23 13:59:40

find中文man

2011-08-16 09:56:22

groupdel中文man

2011-08-25 17:27:58

rewind中文man

2011-08-25 15:54:08

ferror中文man

2011-08-25 10:28:26

nologin中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 15:09:38

clearerr中文man

2011-08-11 16:17:46

autorun中文man

2011-08-23 10:21:40

blockdev中文man
點贊
收藏

51CTO技術棧公眾號