C++读写文件:
头文件 fstream.h
读:ifstream -> open -> seekg -> read -> close
写:ofstream -> open -> seekp -> write -> close
参数:ios::binary 等等 seekg、seekp定位
C读写
FILE* : fopen -> fread -> fwrite -> fclose
数组存到文件:
file.write((char*)QuaryTable,table_size * sizeof(int ));
读:
if( table_size != fread(p_quary_table,4,table_size,fp) )
* fread 的返回值,判断第三个参数,读的个数。
时间: 2024-10-25 17:05:40