- char *buf = (char *)malloc(sizeof(char) * 11);
- unsigned int offset;
- offset = 0;
- CString path = "d:\\1.txt";
- CFile data;
- CFileException mExcept;
- data.Open(path, CFile::typeBinary | CFile::modeRead, &mExcept);
- cout << data.GetLength() << endl << endl;
- data.Seek(offset, CFile::begin);
- data.Read(buf, 10);
- data.Close();
- buf[10] = 0;
- cout << buf << endl;
- data.Open(path, CFile::modeWrite | CFile::modeCreate);
char *writeBuffer;
writeBuffer = (char *)malloc(10);
writeBuffer[0] = 'a';
writeBuffer[1] = 'b';
writeBuffer[2] = 'c';
writeBuffer[3] = 'd';
writeBuffer[4] = 0;
writeBuffer[5] = 'e';
data.Write(writeBuffer, 10);
data.Close();