摘要:#include <stdio.h>int main(){ FILE* file; char buf[1024], ch; file = fopen("test", "r+");//打开文件 //设置缓存 setvbuf(file, buf, _IOFBF, sizeof(buf)); fgets(buf, sizeof(buf), file);//读取一整行 ch = fgetc(file);//读取单个字符 ungetc(ch, file);//把一个字符放回流中 fread(buf, 1, 5, file);//读取二进制数据 ...
阅读全文