I am programming in visual c ++ 2008 for smart device. I am trying to change the name of a txt file. I have a code taken from Microsoft msdn but it does not work for me. The code compiles well and does not give any errors, but does not change the file name. Any ideas? Thanks.
#include "stdafx.h"
#include <stdio.h>
#include <wchar.h>
int _tmain(void)
{
char oldname[] = "alarm.txt";
char newname[] = "prueba.txt";
int _wrename( wchar_t *oldname, wchar_t *newname);
return 0;
}
This is the link: link
I have also tried this way but it does not work either.
#include "stdafx.h"
#include <cstdio>
#include <wchar.h>
#include "Windows.h"
int _tmain(void)
{
char oldname[] = "alarm.txt";
char newname[] = "prueba.txt";
_wrename(oldname, newname);
return 0;
}
I get this error: Error 1 error C3861: 'wrename': no se encontró el identificador c:\Users\P\Documents\Visual Studio 2008\Projects\Rename a file C++ AML\Rename a file C++ AML\Rename a file C++ AML.cpp 13 Rename a file C++ AML