試圖編寫.ply解析器以在OpenGL中使用.ply模型。C++讀取文件時出現未處理的異常
嘗試開始讀取.ply文件並將其寫出所有行。 我的程序做到這一點,但是當它打印出的最後一行我得到未處理的異常:在PLY parser.exe在0x62aad540(msvcr100d.dll)
未處理的異常:0000005:訪問衝突讀取位置00000000。
這是我的代碼:
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
char buffer[10000];
FILE * myFile;
myFile = fopen("walkman.ply", "r");
if(myFile != NULL)
{
while (!feof(myFile))
{
cout<<fgets(buffer, 10000, myFile);
}
fclose(myFile);
}
else
{
cout<<"file not found"<<endl;
}
system("pause");
return 0;
}
這可能是我的代碼中愚蠢的錯誤,但是這將是巨大的,如果有人能找到這個錯誤導致此。
但是你根本沒有使用''。 –
Seagull
2012-03-01 20:33:34