✔ 最佳答案
To read a integer, the simplest way is to use fscanf() :
e.g. fscanf(your_file_pointer, "%d", your_int_var);
But for C++, there is no way to to search on specific row, but there is a way to start the file at specific byte offset, e.g. to start with the offset of 20 bytes after starting:
fseek ( your_file_pointer, 20, SEEK_SET);
For appending a file, just set the openning mode of the file to append mode :
e.g. your_file_pointer = fopen(filename, "a+");
// "w+" is opening a output file and start write at start, while "a+" is opening a output file and start write at the end
2007-05-10 01:16:01 補充:
fscanf is the same as scanf :e.g. :FILE* my_file = fopen("data.txt", "r ");int a;fscanf(my_file, "%d", &a);...fclose(my_file);