请教大家帮忙看看,问题出在哪?? 
    ofstream   outFile; 
    outFile.open("Character.txt",ios::out ¦ios::app);// 
    if(!outFile) 
    {   AfxMessageBox("File   open   failure!!"); 
        return   ; 
    }     for(m=0;m <16;m++)// 
    { 
        outFile < <characterNum[m] < <"     "; 
    } 
    outFile < <endl; 
    outFile.close(); 为什么不能在当前目录下建文件,且若在当前目录下有character.txt时也不能对其做任何的写入,也没有任何的提示错误 若将文件换个路径如:f:\\character.txt则可正常对character.txt操作, 
这是怎么回事??? 
大家帮忙给看看!!

解决方案 »

  1.   

    改成outFile.open(".\\Character.txt",ios::out   ¦ios::app);//  试试 
      

  2.   

    我调过你的代码,没问题!
    #include "stdafx.h"
    #include <fstream.h>
    int main(int argc, char* argv[])
    {
           ofstream       outFile;   
            outFile.open("Character.txt",ios::out   |ios::app);//   
            if(!outFile)   
            { 
    //    AfxMessageBox("File       open       failure!!");   
                    return     1  ;   
            }   
            for(int m=0;m  <16;m++)//   
            {   
                    outFile   << m  <<"           ";   
            }   
            outFile   <<endl;   
            outFile.close();   
    return 0;
    }看来是你的当前目录不允许写吧
      

  3.   

    是不是你的character.txt打开了没有关闭掉,可能是程序异常终止而导致本程序中未关闭,也可能被其他的程序打开了。