由于总是忘记C怎么读写文件,故记录之,后续做补充
一,读取整个TXT文件
FILE *fp = fopen("E:\\test.html", "rb");
fseek(fp, 0, SEEK_END);
int n = ftell(fp);
char *buff = new char[n + 1];
rewind(fp);
fread_s(buff, n, 1, n, fp);
buff[n] = '\0';
fclose(fp);
FILE *fp = fopen("E:\\test.html", "rb");
fseek(fp, 0, SEEK_END);
int n = ftell(fp);
char *buff = new char[n + 1];
rewind(fp);
fread_s(buff, n, 1, n, fp);
buff[n] = '\0';
fclose(fp);