NO

Author Topic: File copy  (Read 3822 times)

lairdre

  • Guest
File copy
« on: May 25, 2007, 08:16:25 PM »
I'm new to Pelles C and this forum. I was looking through some of the non-standard c functions.  Is there one or does one exist in the forum to copy files? I've seen rename, delete and a few other very helpfull ones.

Thanks,

Ron

jcarr

  • Guest
Re: File copy
« Reply #1 on: May 26, 2007, 03:41:50 AM »
You can use API to do this quick routine:
Code: [Select]
int copyf(char copyfrom[], char copyto[])
{
        SHFILEOPSTRUCT fileop;
        fileop.hwnd = NULL;
        fileop.wFunc = FO_COPY;
        fileop.pFrom = copyfrom;
        fileop.pTo = copyto;
        fileop.fFlags = FOF_ALLOWUNDO|FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR;
        if( (SHFileOperation(&fileop)) != 0)
        {
            return 0;
        }
        return 1;
}
You should also need to include <windows.h>... i think  :P

good luck!

jcarr

skirby

  • Guest
Re: File copy
« Reply #2 on: May 30, 2007, 01:27:12 PM »
You can simply use Windows API CopyFile function.

See MSDN for more informations.