Copying a file

This is a discussion on Copying a file within the C Programming forums, part of the General Programming Boards category; How do you copy your applicaiton to another directory? like in vb you can do Filecopy (app.path & "/exename.exe", newdestination) ...

  1. #1
    Unregistered
    Guest

    Copying a file

    How do you copy your applicaiton to another directory? like in vb you can do

    Filecopy (app.path & "/exename.exe", newdestination)

    i am using lcc win32 compiler

  2. #2
    Sayeh
    Guest
    This is somewhat more complicated than just moving the file data. You could do this by opening it, reading it, writing it to the new location, closing it and then setting its permissions. Then delete the original.

    However, this ignores the fact that the registry was altered when the application was originally installed, so you'd also have to edit the registry and anything that expects the app to be in the position you're moving it away from.

    enjoy.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Code:
    #include <windows.h>
    ...
    CopyFile("source.txt","target.txt",0);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 11:39 PM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 04:53 AM
  3. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 08:51 PM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05:54 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21