CFile file("example.txt", CFile::modeReadWrite); file.SeekToEnd();
CFile file("example.bin", CFile::modeCreate | CFile::modeWrite); for (int i = 0; i < 10; i++) { int num = i * 2; file.Write(&num, sizeof(int)); } file.SeekToEnd();In this example, a binary file named "example.bin" is created in write mode. A for loop is used to write the values of i*2 to the file. The SeekToEnd function is called after the loop to move the file pointer to the end of the file. The package library for CFile is MFC (Microsoft Foundation Classes).