Reading and writing integers to a binary file using C?
问题 I am trying to write 100 integers to binary file. I have tried writing to this file, and reading from it. When reading from it I get completely random digits. Here is the block concerning the write. Do note I have the file open for write with "wb" mode. I have also closed the file at the end. for (int i = 0; i < 99; i++) { fwrite(&i, sizeof(int), 1, file); } Here is the block concerning the read. Do note I do have the file open here in "rb" mode and it is closed. int num; for (int i = 0; i <