Rename a textfile in a GUI CLI project

softwaretime (24)
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.
Splux (50)
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.
joneele (28)
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
Registered users can post here. Sign in or register to post.