用CFile::Seek
virtual LONG Seek( LONG lOff, UINT nFrom );
throw( CFileException );Return ValueIf the requested position is legal, Seek returns the new byte offset from the beginning of the file. Otherwise, the return value is undefined and a CFileException object is thrown.ParameterslOffNumber of bytes to move the pointer.nFromPointer movement mode. Must be one of the following values: CFile::begin Move the file pointer lOff bytes forward from the beginning of the file.
CFile::current Move the file pointer lOff bytes from the current position in the file.
CFile::end Move the file pointer lOff bytes from the end of the file. Note that lOff must be negative to seek into the existing file; positive values will seek past the end of the file.
virtual LONG Seek( LONG lOff, UINT nFrom );
throw( CFileException );Return ValueIf the requested position is legal, Seek returns the new byte offset from the beginning of the file. Otherwise, the return value is undefined and a CFileException object is thrown.ParameterslOffNumber of bytes to move the pointer.nFromPointer movement mode. Must be one of the following values: CFile::begin Move the file pointer lOff bytes forward from the beginning of the file.
CFile::current Move the file pointer lOff bytes from the current position in the file.
CFile::end Move the file pointer lOff bytes from the end of the file. Note that lOff must be negative to seek into the existing file; positive values will seek past the end of the file.
文件一打开指针就指向文件开头
但是你可以移动指针的
通过Seek()
用法去查MSDN
我本来的想法是跳过认证信息拷一个临时文件,把临时文件交给处理程序,可是头儿说这样太慢,会降低速度(faint),所以只好再想其他办法了。
衷心谢谢各位的帮忙!
一个新新新手:)
再说你的问题,好像是不行的,因为即使你真的没有从开始打开文件,处理程序打开文件后难道不会读到前面的数据吗?我倒是有一个解决方法,就是在内存中建一块虚拟硬盘,将教研信息后的数据拷上去。至于建虚拟硬盘的方法……可能需要用到设备驱动编程的知识,不过你大概可以找到现成的程序。
还有一个方法没试过,不知行不行,就是CMemFile,你试一下,如果可以的话说一声。