现想将一个字符串
例如:
CString strValue;
strValue = "select xx from table ";写到一个空白的文本文件中,
谢谢各位

解决方案 »

  1.   

    CreateFile
    WriteFile也可以用CStdioFile的WriteString
      

  2.   

    CStdioFile file;
    file.Open(.........);
    file.WriteString(strValue );
    file.close();
      

  3.   

    CString strValue;
    strValue = "select xx from table ";
    CStdioFile f;
    if ( f.Open( FilePath ,CFile::modeCreate|CFile::modeWrite  ) )
    {
    f.WriteString( strValue );
    f.Close();
    }
      

  4.   

    还是用流吧~~
    #include "fstream.h"fstream In("Result.txt",ios::in|ios::out);

    In<<"select xx from table "<<'\n';
      

  5.   

    FILE * file;
    file = fopen(path,"w");
    fprintf(file,"select xx from table ");
    fclose(file);
      

  6.   

    关闭之后就保存了或者用Flush()
      

  7.   

    在控制台程序中使用CString要包含头文件吗?