2013-12-13 40 views
-1

我正在嘗試讀取包含近60000個字的文本文件。 這是我爲它編寫的代碼..編譯器顯示此錯誤消息: FileReading.exe中的0x77cee3be未處理的異常:0xC0000005:訪問衝突讀取位置0x02affa79。此行 COUT < <「文字閱讀... < 但是,當我跑在調試模式下,該代碼..編譯didnt顯示任何錯誤。每一件事情能正常工作。請幫我出... 我寫。此代碼爲控制檯應用程序執行時出錯文件在VC++中讀取代碼.net

int Per=25; 
int inter=14527; 
if(ifile) 
{ 
    while(!ifile.eof()) 
    { 
     ifile>>input; 
        /* doing some work here 

        */ 

     noOfWord++; 

       //i want to show this info to user.. Total percentage of words 
        read from file ...like "Reading Words ... 25%" 

     //if(noOfWord==inter) 
     //{ 
     // //Sleep(1000); 
     // cout<<"Reading Words..."<<Per<<"%"; 
     // inter*=2; 
     // Per+=Per; 
     //} 
    } 
} 
else 
{ 
    cout<<"File Not Open"; 
    exit(0); 
} 

回答

0

cout<<"Reading Words...<<Per<<"%";是沒有好 - 你忘了終止報價

你想cout<<"Reading Words..."<<Per<<"%";

+0

我錯過了這一個,而郵政代碼.. ..但不。我的行爲代碼 – UMR