#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string header;
int main (int argc, char * const argv[]) {
// insert code here...
ifstream infile("model_input.txt");
if (infile.fail())
{
cout<< "Could not open model input.txt" << endl;
}
//read in the headers
getline (infile,header);
infile.close();
return 0;
}
If the file: model_input.txt exists, I get this error:
Quote
[Switching to process 257]Running…
test(368) malloc: *** error for object 0x10000a700: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Program received signal: “SIGABRT”.
(gdb)
test(368) malloc: *** error for object 0x10000a700: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Program received signal: “SIGABRT”.
(gdb)
If the file does not exist, I get this:
Quote
run
[Switching to process 345]
Running…
Could not open model input.txt
(gdb)
[Switching to process 345]
Running…
Could not open model input.txt
(gdb)
I think it's a permissions problem with the file, but can't see why:
-rwxrwxrwx 1 CTphpnwb staff 12 Sep 21 23:28 model_input.txt
This is using C++ Command Line Tool in Xcode 3.2 on Snow Leopard (10.6.1).
Any ideas?

New Topic/Question
Reply



MultiQuote





|