Link to home
Start Free TrialLog in
Avatar of tariq6000
tariq6000

asked on

Rename a file

Hi Experts,
I want to rename my file.When I pass the contant string it is working but when i pass the string using variable it popup a messagebox :
 "can't rename file : select only one file to rename , or use MS-DOS wildcard (e.g *.txt) to raname a group of files with similar names"

I writeen the code like this plz check (projecy is unicode enabled)

CString szFilePath,szFileName,szFileExt,szNewFilePath;
LPCTSTR lpSourceFileName;
lpSourceFileName=szSourceFilePath;

SHFILEOPSTRUCT sfo;
ZeroMemory ( &sfo, sizeof (SHFILEOPSTRUCT));
sfo.wFunc = FO_MOVE ;
CString szFN=_T("f:\\pp.txt");
sfo.pFrom =szFN;//lpSourceFileName;//+_T("\0\0");
sfo.pTo = _T("f:\\pp3.txt\0");
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin