code vault - copy_fileWhat links here?
This copies a file from one location to another, preserving the creation and last access times.

Code

//#############################################################################
void copy_file(char* source, char* destination)
{
    FILE*   infile;
    FILE*   outfile;
    char*   buffer[8192];
    size_t  count_read;
    size_t  count_written;
    
    if(infile = fopen(source, "rb")) {
        if (outfile = fopen(destination, "wb")) {
            while (!feof(infile) && !ferror(outfile)) {
                count_read = fread(buffer, 1, 8192, infile);
                count_written = fwrite(buffer, 1, count_read, outfile);
            }
            fclose(outfile);
            struct stat buf;
            stat(source, &buf);
            utimbuf times;
            times.actime  = buf.st_atime;
            times.modtime = buf.st_mtime;
            utime(destination, &times);
        }
        else {
            printf("failed to open %s for output\n", destination);
        }
        fclose(infile);
    }
    else {
        printf("failed to open %s for input\n", source);
    }
}


code vault - copy_file
linux - environment variables
linux - create mount point
programming - Libre Calc - accessing cells
programming - windows - display a bitmap in a window
programming - cgi - cookies
programming - windows - win32 functions
programming - windows - directx
linux software - CAD
code vault - spin
programming - Libre Calc - cell content types
programming - windows - buttons
tk - tk widgets
programming - algorithms - graph drawing drawing a scale
programming:lisp
linux - software
programming - DDE - Excel DDE Server
programming - windows - services
filename:code vault - copy_file
filename:code%20vault%20%2D%20copy_file
last edit:March 26 2009 22:35:48 (6436 days ago)
ct = 1794244096.000000 = November 09 2026 17:08:16
ft = 1238106948.000000 = March 26 2009 22:35:48
dt = 556137148.000000