1

自今年冬天以来,我正在开发我的第一个游戏应用程序,现在我遇到了一个非常奇怪的问题。

使用 Embarcadero C++ Builder XE 我的应用程序总是正常编译和运行,但今天无法启动,但仍然编译成功!
我只是像往常一样按“运行”,查看控制台输出“成功经过时间等”,然后 - 什么也没有。我的应用程序的窗口只是没有出现。

我发现问题出在这段代码中:

ifstream file;
file.open(fileWithTextureProp, ios::binary);

int length;
char * buffer;
// get length of file:
file.seekg (0, ios::end);
length = file.tellg();
file.seekg (0, ios::beg);

// allocate memory:
buffer = new char [length+1];
buffer[length] = '\0';

// read data as a block:
file.read (buffer,length);

xml_document<> doc;
doc.parse<0>(buffer);

/*
 some xml parsing here, if I delete or comment this - nothing changes
   */

delete[] buffer;

file.close(); // NOTE: if I comment this line - program properly starts (!)

我究竟做错了什么?

4

0 回答 0