Rename a textfile in a GUI CLI project

Feb 6, 2013 at 4:51pm
Hello, can somebody please show me how to rename a textfile in a Visual C++ CLI GUI project. I've tried using the 'rename()' function but that isn't working for me (probably because of the type of project). Help and advice appreciated in advance.
Feb 6, 2013 at 5:21pm
http://msdn.microsoft.com/en-us/library/system.io.file.move.aspx

File::Move("C:\\test\\file.ext", "C:\\test\\newname");

I haven't tried it, but I assume that it'd work.
Feb 6, 2013 at 5:44pm
More examples How to rename files...

C

1
2
3
4
5
6
#include <stdio.h>
int main()
{
rename("c:\\name.txt","c:\\name2.txt");
return 0;
}


or

1
2
3
4
5
6
#include <stdio.h>
int main()
{
system("REN c:\name1.txt c:\name2.txt");
return 0;
}
Last edited on Feb 6, 2013 at 6:47pm
Topic archived. No new replies allowed.