| | |
Using CopyFile() in win32 api
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
I dont know how to use CopyFile() function in my "program"
Can you help me?
Can you help me?
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <windows.h> using namespace std; int main() { CopyFile(`C:\\start.exe` `C:\\Program Files\\banana`); system("color 2"); cout<<"POZDRAVLJEN UPORABNIK\n"; cout<<"STRAN WWW.EX-PLANET.COM TE POZDRAVLJA!\n"; system("start www.ex-planet.com"); cout<<"UPAM, DA SE BOS REGSTRIRAL NA NJEJ!\n"; cout<<"OBILO UZITKOV OB PREBIRANJU IN PISANJU FORUMA/NA FORUM!\n"; cout<<"ZA VSE INFORMACIJE SMO DOSEGLJIVI NA: klemen101@hotmail.com\n"; cout<<"ALI PA NA : rokerist1@hotmail.com\n"; cout<<"MADE BY -ex-\n"; cin.get(); }
Here's the article on CopyFile in the MSDN library:
http://msdn2.microsoft.com/en-us/library/aa363851.aspx
Your code here has several problems:
First of all, why are you using backticks? Use quotes instead. You *might* want to cast it to LPCTSTR, as that is the format that this function expects strings in.
Secondly, you fail to specify the final parameter, bFailIfExists. Quoting from the article,
Hope this helps
http://msdn2.microsoft.com/en-us/library/aa363851.aspx
Your code here has several problems:
C++ Syntax (Toggle Plain Text)
CopyFile(`C:\\start.exe` `C:\\Program Files\\banana`);
Secondly, you fail to specify the final parameter, bFailIfExists. Quoting from the article,
•
•
•
•
If this parameter is TRUE and the new file specified by lpNewFileName already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
um...could you correct code
C++ Syntax (Toggle Plain Text)
CopyFile("C:\\start.exe", "C:\\Program Files\\banana");
Last edited by jan1024188; Jan 14th, 2007 at 10:24 am.
•
•
•
•
um...could you correct code
C++ Syntax (Toggle Plain Text)
CopyFile("C:\\start.exe", "C:\\Program Files\\banana");
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
C++ Syntax (Toggle Plain Text)
CopyFile("C:\\start.exe", "C:\\Program Files\\banana.exe", "f");
is this ok?
•
•
•
•
C++ Syntax (Toggle Plain Text)
CopyFile("C:\\start.exe", "C:\\Program Files\\banana.exe", "f");
is this ok?
Last edited by Ancient Dragon; Jan 14th, 2007 at 12:30 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
•
•
bFailIfExists
[in] If this parameter is TRUEand the new file specified by lpNewFileName already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
For an example look here.
Last edited by ~s.o.s~; Jan 14th, 2007 at 1:41 pm.
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- Creating A Table With Win32 Api (C++)
- anyone understand win32 api? (C)
- How to Install Perl Mod Win32-API (Perl)
- Win32 API Struct (Perl)
Other Threads in the C++ Forum
- Previous Thread: C++ guidelines
- Next Thread: c++ dvd shop
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






