能的话怎么用不能的话该怎么解决别告诉我用CFile啊

解决方案 »

  1.   

    可以用的。
    和dos下程序一样用吧。
      

  2.   

    C run time libray包含大部分的C语言函数
      

  3.   

    1. C的方式:
    FILE *p;
    p=fopen("c:\\1.txt","w");
    fwrite("abc",1,4,p);
    fclose(p);2. C++的方式:
    ofstream f("c:\\1.txt");
    f.write("hello",5);3. MFC的方式:I. 写文件:
    CFile f("c:\\1.txt",CFile::modeWrite|CFile::modeCreate);
    f.Write("hello",5);
    a.几个标志的作用:
      CFile::modeCreate:没有指定的文件就产生一个新文件,
                           有就打开该文件,并将它裁剪到0;
      CFile::modeNoTruncate :打开文件时不裁剪到0;
    b.写数据到文件末尾:
    CFile f("c:\\1.txt",CFile::modeWrite|
              CFile::modeCreate|CFile::modeNoTruncate);
    f.SeekToEnd();
    f.Write("hello",5);II. 读文件:
    CFile f("c:\\1.txt",CFile::modeRead);
    char buf[10];
    memset(buf,0,10);
    f.Read(buf,5);
    MessageBox(buf);
      

  4.   

    SDK 还有CreateFile 和 ReadFile & WriteFile
      

  5.   


    fprintf 可以用,她在MFC应用程序中表示字符串格式的转换。有点像format.
    s = fpringf("%s",i);就是把一个整形转为字符串。