用createfile打开文件后,我想在文件信息开始处写入信息。我设定指针在开始处,但是我写入信息的时会覆盖以前文件的内容,怎样才能不覆盖以前的内容。写入信息时以前的信息自动往后移(插入模式)。

解决方案 »

  1.   

    DWORD SetFilePointer(
      HANDLE hFile,          // handle of file
      LONG lDistanceToMove,  // number of bytes to move file pointer
      PLONG lpDistanceToMoveHigh,
                             // pointer to high-order DWORD of 
                             // distance to move
      DWORD dwMoveMethod     // how to move
    );dwMoveMethod 
    Starting point for the file pointer move. This parameter can be one of the following values. Value Meaning 
    FILE_BEGIN The starting point is zero or the beginning of the file. 
    FILE_CURRENT The starting point is the current value of the file pointer. 
    FILE_END The starting point is the current end-of-file position. 
      

  2.   

    windows的文件系统目前不支持这种功能,需要自己实现把文件里面的内容读出来,然后拼接在需要写入的信息后面,然后将整个内容一起写入