Including space in path for windows 2000
Posted on 2004-08-06
I have to copy a file form one location to another using c++ in windows 2000. I have the following code.
//I use the CFileDialog Dlg to get the file location
szFilename = Dlg.GetPathName();
destfile = "C:\pic.bmp";
sprintf(syscommand,"copy %s %s",szFilename,destfile);
int i = system(syscommand);
if(i != 0)
AfxMessageBox( "Could not copy because file is in desktop or file name has space in between");
when the source file is in desktop......then the path wil be
c:\Documents ans Settings\Administrator\Desktop\pic.bmp but as windows 2000 represents it as
C:\DOCUME~1\ADMINI~1\DESKTOP my code above doesnt work.
How do I solve this problem. Thankyou