CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's wrong with my codes?



This worked>>

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    String WinDir = "c:\\windows\\";
    String name = "Rick";
    String pwlfile = WinDir + name +".pwl";
    String dllfile = WinDir + "OCX255" + name + ".dll";
    char *oldfile = pwlfile.c_str();
    char *newfile = dllfile.c_str();
    if(CopyFile(oldfile, newfile, TRUE))
	{
  	    ShowMessage("Returned non-zero");
	}
}
There's some decision you must make in the CopyFile(const char*,const
char*,int) parameter. The int is TRUE or FALSE, depending on if you want
the newfile overwritten if it already exists. But that's your desistion, I
chose to.

To convert a string to a char (or const char) use string.c_str( )

Rick Malik
rmfci@pacbell.net
"Visit the C++ Builder Hobby Pages"
http://home.pacbell.net/rmfci/bcbhp.htm


W Komornicki's Home Page | Main Index | Thread Index