用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. 

解决方案 »

  1.   

    什么意思啊
    文件一打开指针就指向文件开头
    但是你可以移动指针的
    通过Seek()
    用法去查MSDN
      

  2.   

    对不起,是我没把问题说清楚,我希望用户要打开特殊后缀的文件时,先经过我的程序检验用户是否合法(通过前面的认证信息),若合法的话,我再调用相应的处理程序(例如Notepad,IE)来解释这个文件,可是Notepad和IE传入的命令行参数都是文件路径名,所以我没法把通过改变头指针来跳过前头的认证信息。
       我本来的想法是跳过认证信息拷一个临时文件,把临时文件交给处理程序,可是头儿说这样太慢,会降低速度(faint),所以只好再想其他办法了。
       衷心谢谢各位的帮忙!
                                                 一个新新新手:)
      

  3.   

    Faint!你们头儿居然有这嗜好!他不是嫌慢吗?让他换个SCSI硬盘。
    再说你的问题,好像是不行的,因为即使你真的没有从开始打开文件,处理程序打开文件后难道不会读到前面的数据吗?我倒是有一个解决方法,就是在内存中建一块虚拟硬盘,将教研信息后的数据拷上去。至于建虚拟硬盘的方法……可能需要用到设备驱动编程的知识,不过你大概可以找到现成的程序。
       还有一个方法没试过,不知行不行,就是CMemFile,你试一下,如果可以的话说一声。
      

  4.   

    不过CMemFile八九成是不行的。