我想在第2,4,6,双行写文件,该怎么办?
注意:我的文件原来1,3,5单行有内容,不可以破坏的~
!!!!
   帮帮我~

解决方案 »

  1.   

    char* pFileName = "test.dat";
    CStdioFile f1;
    if( !f1.Open( pFileName, CFile::modeCreate|CFile::modeWrite|File::typeText ) )
    {
       #ifdef _DEBUG
          afxDump << "Unable to open file" << "\n";
       #endif
       exit( 1 );
    }
    const int nMax = 100;
    char lpsz[6][nMax];
    for (int i=0; i<6; i++)
    {
        if (i%2 == 0)
           f1.ReadString(lpsz[i], nMax); //单行读跳过
        else
           f1.WriteString(lpsz[i], nMax);// 双行写
    );