CFile file("myfile.txt", CFile::modeRead); // open the file for reading file.SeekToBegin(); // move the file pointer to the beginning of the file
CFile file("myfile.dat", CFile::modeReadWrite | CFile::typeBinary); int pos = 1024; // position to seek to file.SeekToBegin(); // move the file pointer to the beginning of the file file.Seek(pos, CFile::begin); // move the file pointer to position 1024In this example, we create a CFile object and open a binary file named "myfile.dat" for reading and writing using the `modeReadWrite` and `typeBinary` parameters. Then, we use `SeekToBegin()` to move the file pointer to the beginning of the file and `Seek()` to move it to a specific position (1024) relative to the beginning of the file using the `begin` parameter. Overall, CFile::SeekToBegin() is a useful function for manipulating file pointers in MFC applications.