first man open

#include <errno.h>
if ((in = open(source, O_RDONLY)) == -1)
{
        perror("open"); /* should print reason */
        exit(1);
}

--- [EMAIL PROTECTED] wrote:
> I use this code to copy a file :
> 
> int copy_file(char *source, char *dest)
> {
>   char c;
>   int in, out;
> 
>   in = open(source, O_RDONLY);
>   out = open(dest, O_WRONLY|O_CREAT,
> S_IRUSR|S_IWUSR);
>   while(read(in, &c, 1) == 1)
>         write(out, &c, 1);
> }
> 
> I'd like to add a check for looking if the file is
> copied (no empty disk and
> such). What is the best way to do this ?
> 
>
-------------------------------------------------------------------------
> De Messemaeker Johan
> Research & Development
>       HEMMIS n.v.
>       Koning LeopoldIII-laan 2, 8500 Kortrijk
>       Tel.: 32 (0)56/37.26.37
>       Fax: 32 (0)56/37.23.24
> Current Project : VMM Aalst
> 
> 

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
  • filecopy j . demessemaeker
    • Canul Podkopayeva

Reply via email to