#include <stdio.h>
#include <sys/type.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#define BUFF_SIZE 1024
#define OFFSET 1024
int main(int argv , char * argc[])
{
char * filename;
printf("please input the file name /n");
scanf("%s" ,filename);
int fileid_s , fileid_o;
char buff[BUFF_SIZE] ;
int read_len;
if(access(filename,F_OK) ==0)
{
fileid_s =open(filename,O_RDWR);
printf("pleas input the coloen file name /n ");
char * file_object_name;
int file_object;
file_object=open(file_object,O_RDWR,0600);
if(file_object<0 || fileid_s<0 )
{
printf("the object or source file open file /n");
exit(1);
}
lseek(fileid_s,-OFFSET,SEEK_END);
while((read_len=read(filedid_s,buff,sizeof(buff)))>0)
{
write(file_object,buff,read_len);
}
close(file_object);
close(fileid_s);
}
else
{
printf("the file dont exit or the file name that you input is not correct /n");
}
return 0;
}
#include <sys/type.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#define BUFF_SIZE 1024
#define OFFSET 1024
int main(int argv , char * argc[])
{
char * filename;
printf("please input the file name /n");
scanf("%s" ,filename);
int fileid_s , fileid_o;
char buff[BUFF_SIZE] ;
int read_len;
if(access(filename,F_OK) ==0)
{
fileid_s =open(filename,O_RDWR);
printf("pleas input the coloen file name /n ");
char * file_object_name;
int file_object;
file_object=open(file_object,O_RDWR,0600);
if(file_object<0 || fileid_s<0 )
{
printf("the object or source file open file /n");
exit(1);
}
lseek(fileid_s,-OFFSET,SEEK_END);
while((read_len=read(filedid_s,buff,sizeof(buff)))>0)
{
write(file_object,buff,read_len);
}
close(file_object);
close(fileid_s);
}
else
{
printf("the file dont exit or the file name that you input is not correct /n");
}
return 0;
}