0 CreatorZeus 4 Years Ago chan someone help me see this problem? its closed and everything. string notename; x = 1; cout << notename[x] << endl; if(remove(notename[x].c_str()) != 0) { perror( "Error deleting file" ); } else { cout << "File successfully deleted"; } c++
0 Ancient Dragon 5,243 4 Years Ago line 5 is wrong -- notename[x] is a single character and c_str() returns a string. Maybe line 1 is incorrect -- string notename[10]; which would mean notename is an array of string objects. string notename = "filename.txt"; x = 1; cout << notename << endl; if(remove(notename.c_str()) != 0) { perror( "Error deleting file" ); } else { cout << "File successfully deleted"; } Edited 4 Years Ago by Ancient Dragon