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";
}
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";
}
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";
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.