ifstream addressing file

Hi dear friends,

I run my program under gcc compiler in ubuntu.
It issues error:
Assertion `appFile.is_open()' failed.


Some part of my code is:

void NoximMasterPE::loadApplication(string Folder, int index)
{
string line;
ifstream appFile(Folder+"/App.inf"); // ***error come from here***
string appName = Folder.substr(Folder.find_last_of('/') + 1);
NoximIndexConverter indConv;

NoximApplication *app = &AppSet.Application[index];
app ->name = new char[appName.size()];
app ->name = appName;
cout << "test1" << "\n";
assert(appFile.is_open());
while(appFile.eof() == false)
{
appFile >> line;
.
.
....
-------------------------------------

I would highly appreciate it, if you help me.

Really thanks in advance.

Mohammad.







File cannot be opened. Try debug that part of code and see if path to file is correct. If it is then you coud have not permissions to open file/file is already open in other program etc.
Verify that Folder+"/App.inf" exists on the file system.

1
2
app ->name = new char[appName.size()];
app ->name = appName;
should probably be
1
2
app ->name = new char[appName.size() + 1];
strcpy(app ->name, appName.c_str());


I think you'll have quite a few issues if this is representative of the rest of your code.
Topic archived. No new replies allowed.