📄 filetobuf.h
字号:
#include<iostream>#include<string.h>#include<stdlib.h>#include<fstream>#include<locale>using namespace std;char buf[5][1024]; //bufferint flag = 0; //bufferflagfstream fis; //input file fstream fstream fanchor; //output anchor text and url file fstreamfstream ftext; //output title and text file fsteam//read file initializationint initread(char *filename) { fis.open(filename, ios::in);// cout<<"The file:"<< filename <<endl;// cout<<sizeof(buf[flag])<<endl; return 0;}//read file's content into the bufferint readbuf() { int readnum; if (fis.read(buf[flag], sizeof(buf[flag]))) { // cout << buf[flag]; flag = (flag +1) % 5; // cout<<"change to buf: "<< flag <<endl; return 0; } else { readnum = fis.gcount(); buf[flag][readnum]= '\0'; // cout<<buf[flag]<<endl; return 1; }}//Reading end, close the filestreamvoid ReadEnd() { fis.close();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -