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 的返回值,判断第三个参数,读的个数。

 

相关文章:

  • 2022-01-02
  • 2022-12-23
  • 2021-07-20
  • 2020-06-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2021-06-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2021-08-29
  • 2022-01-14
相关资源
相似解决方案