标签:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <stdio.h>int main(){ FILE *input, *output; char bufr[512]; input = fopen("file.in", "r+b"); output = fopen("file.out", "w"); /* set up input stream for minimal disk access, using our own character buffer */ if (setvbuf(input, bufr, _IOFBF, 512) != 0) printf("failed to set up buffer for input file\n"); else printf("buffer set up for input file\n"); /* set up output stream for line buffering using space that will be obtained through an indirect call to malloc */ if (setvbuf(output, NULL, _IOLBF, 132) != 0) printf("failed to set up buffer for output file\n"); else printf("buffer set up for output file\n"); /* perform file I/O here */ /* close files */ fclose(input); fclose(output); return 0;} |
标签:
原文地址:http://www.cnblogs.com/lvdongjie/p/4955894.html