CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 1999
    Location
    Coventry/ United Kingdom
    Posts
    38

    Which Command line to use in VC program to copy files from drive C: to Drive A

    Dear All,

    I am trying to write a code for which on click of a button I want to copy files from drive C: to drive A:

    I do not know which command to use. Is it something like "ShellCopy "
    Pleaee write me this line of code if you have come across it.
    If you can please write a dummy code which I can just copy.
    Any help will very much be appreciated.


    Please reply to author

    Kind Regards

    Qasim Raza Iqbal

  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Which Command line to use in VC program to copy files from drive C: to Drive A

    you can use the SHFileOPeration API and use the FO_COPY flag


  3. #3
    Join Date
    Jul 1999
    Location
    Coventry/ United Kingdom
    Posts
    38

    Re: Which Command line to use in VC program to copy files from drive C: to Drive A

    Dear Sir, I have used the following line and I get errors please see if you could help me Thanks.

    SHFileOperation(NULL, FO_COPY, _T("\\SOFTWARE\\ide\\idebat.bat"),"a:\\",NULL);



    Please reply to author

    Kind Regards

    Qasim Raza Iqbal

  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: Which Command line to use in VC program to copy files from drive C: to Drive A

    try this

    SHFileOperation(NULL, FO_COPY, _T("\\SOFTWARE\\ide\\idebat.bat"),"a:\\idebat.bat",NULL);



    and always check for errors using GetLastError and FormatMessage to get a readable error text.


  5. #5
    Join Date
    Apr 1999
    Location
    Germany
    Posts
    418

    Re: Which Command line to use in VC program to copy files from drive C: to Drive A

    Hi Qasim,

    of course you get an error message becuase SHFileOperation takes only one argument of type LPSHFILEOPSTRUCT, a poiner to a structure. But why don't you use the API function CopyFile simply?

    Martin

  6. #6
    Join Date
    Jul 1999
    Location
    Coventry/ United Kingdom
    Posts
    38

    Re: Which Command line to use in VC program to copy files from drive C: to Drive A

    Hi Martin,

    Thanks for the above advice. Please if you could write that line of code I want to copy a file from drive c:\ software to a:\
    Your Help will very much be appreciated.

    Please reply to author

    Kind Regards

    Qasim Raza Iqbal

  7. #7
    Join Date
    Jul 1999
    Location
    Romania - Iasi
    Posts
    558

    Re: Which Command line to use in VC program to copy files from drive C: to Drive A

    Try thsi:

    CopyFile("c:\\software\\idle.bat", "a:\\idle.bat", FALSE);





    Let me know if this help u
    Regards,
    Ovidiu


  8. #8
    Join Date
    Jul 1999
    Location
    Coventry/ United Kingdom
    Posts
    38

    Re: Which Command line to use in VC program to copy files from drive C: to Drive A

    Thanks Mate SORTED

    Please reply to author

    Kind Regards

    Qasim Raza Iqbal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured