Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

Could someone explain why I'm getting a memory leak with the following short / simple c++ code? Thanks!

OpenStudy (anonymous):

int readFile(char fileName[], string type) { ifstream theFile (fileName); if (!theFile.is_open() ) { cout << "Could not open file: " << fileName << endl; theFile.close(); exit(1); } //do stuff here theFile.close(); return 1; } int main ( int argc, char *argv[]) { int validFile = readFile(argv[1], "obj"); }

OpenStudy (anonymous):

figured it out.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!