jmsloan
asked on
Rename file in C++
I am trying to rename a file with the following code and I get a
error renaming file: No Such File or Directory
This oldname variable does exist
any thoughts?
#include <stdio.h>
int main ()
{
int result;
char oldname[] ="C:\cplus\trythis.txt";
char newname[] ="C:\cplus\newfolder\newna me.txt";
result= rename( oldname , newname );
if (result != 0 )
perror( "Error renaming file" );
cout << oldname;
return 0;
}
Thanks,
jmsloan
error renaming file: No Such File or Directory
This oldname variable does exist
any thoughts?
#include <stdio.h>
int main ()
{
int result;
char oldname[] ="C:\cplus\trythis.txt";
char newname[] ="C:\cplus\newfolder\newna
result= rename( oldname , newname );
if (result != 0 )
perror( "Error renaming file" );
cout << oldname;
return 0;
}
Thanks,
jmsloan
What about "newfolder"? Does that folder exist?
ASKER
yes it does. I'm on xp does that matter.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thats what it was,
Thanks
Thanks