txtファイルに書き込んでいるときまで追跡しました。開いていることを確認し、クラッシュする前にファイルに行を書き込みます。
VS2012 外部デバッガーはこれをスローし、fstream ヘッダー内のUnhandled exception at 0x77112D24 (ntdll.dll) in DTC.exe: 0xC0000005: Access violation writing location 0x10000000
この関数を示します。virtual __CLR_OR_THIS_CALL ~basic_filebuf()
void main()
{
vector<string> fileNames;
vector<time_t> fileTimes;
CImg<unsigned char> image("Image.bmp");
ofstream out("Result_Data.txt",ios::out|ios::app);
if(!out.is_open())
{
cout<<"File Not Opened!\n";
}
unsigned long originalSize = my_image_functions::getFileSize("Image.bmp");
time_t before = 0, after = 0;
before=clock();
my_image_functions::compressDualLevelBTC(image,"dualBTC_2_8.dtc",2,8);
after = clock();
fileTimes.push_back(after-before);
fileNames.push_back("dualBTC_2_8.dtc");
//...
/* Several of these segments*/
//...
before=clock();
my_image_functions::compressDualLevelBTC(image,"dualBTC_32_64.dtc",32,64);
after = clock();
fileTimes.push_back(after-before);
fileNames.push_back("dualBTC_32_64.dtc");
while(!fileNames.empty() && !fileTimes.empty())
{
out<< fileNames.back() <<";"<< fileTimes.back() <<";"<< my_image_functions::getFileSize(fileNames.back()) << ";" << ((float) originalSize)/my_image_functions::getFileSize(fileNames.back()) << endl;
fileNames.pop_back();
fileTimes.pop_back();
if(!out.is_open())
{
cout<<"File Not Opened!\n";
}
}
out.close();
}