Thread: Beginner question: moving file please help.

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    5

    Beginner question: moving file please help.

    Never mind question answered
    Last edited by Tjm7777; 04-11-2009 at 10:06 PM.

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    5
    someone?

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    20
    As i understand you want to make a program which will move a file to a different location on your hard drive. I have 2 solutions:

    1)you can use "system" function from stdlib.h(as i think) which executes commansd from your system like you are in a command promt.for example calling function like this
    system("copy autoexec.bat c:\windows"); will call copy command to copy autoexec to c:\windows dir.

    2)you can manually make the move you want, use fopen function to open the file AIM.exe
    read every byte of it with fread function and write every byte to a new created file on the dir you want(C:\Documents and Settings\user\Start Menu\Programs\Startup). Then delete the old file(the file from your desktop) using del command and system function.

    You can find 1000 ways to make move your file

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Or, if you want to use the Windows API functions, you can use:
    MoveFile Function (Windows)
    or
    CopyFile Function (Windows)

    Which you want to use depends on whether you actually want to COPY or MOVE the original file.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  4. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  5. Beginner Text File Input Question
    By Ruggles in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2006, 02:18 PM