Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copyfile using a save as dialog?

Status
Not open for further replies.

Kurono

Programmer
Mar 22, 2006
4
IE
Hi,

I'm sure this is something simple but its giving me trouble. I'm trying to copy a file to a location that the user specifies in a save as dialog. The file copies correctly if the location to copy is where the source file is, but it wont copy to any other path.

Code:
if( this->saveFileDialog1->ShowDialog() == DialogResult::OK ) 
{ String *savename = saveFileDialog1->FileName; char* csavename = (char*)(void*)Marshal::StringToHGlobalAnsi(savename); CopyFile("tempsave.cap",csavename, TRUE); Marshal::FreeHGlobal(csavename); 
}


Any idea whats wrong? Am I supposed to extract the path name from 'savename' first?
 
You should probably look for a class memeber like "fullpath". File name is usually only the file's name, not including the path.

I hope that helps,

Vincent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top