home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5588 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.tau.ac.il!usenet
  2. From: Avi Lev <avil@sapiens.com>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Copy with c
  5. Date: Sun, 17 Mar 1996 12:57:01 +0200
  6. Organization: Sapiens Technologies
  7. Message-ID: <314BEFFD.1B98@sapiens.com>
  8. References: <660.6643T24T753@enterprise.net>
  9. NNTP-Posting-Host: honda.sapiens.co.il
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Mark Smith wrote:
  16. > This may seem like a simple thing. But i am new to using C.
  17. > How do i get a program to copy a file, that will be in the same
  18. > directory as the program, to a user defined place. (sort of like
  19. > installer programs) ?
  20.  
  21. well, there're 2 ways to handle it, the simplest way would be to call the system() function.
  22. this function is for calling CLI system commands for withing a C program, all you have to do is 
  23. give it the string of the command and it does the rest, also make sure to check any error code 
  24. it returna, so there'll be no surprises. about the 2nd way, well you could use fopen() to open 
  25. the input/output files and then use fread() and fwrite() to do the transfer, but you'll be 
  26. inventing the wheel, use the 1st way.
  27.  
  28. Avi Lev.
  29.