Horje
c program to implement mv command Code Example
c program to implement mv command
#include<sys/types.h>
#include<sys/stat.h>
#include<stdio.h>
#include<fcntl.h>
main( int argc,char *argv[] )
{
int i,fd1,fd2;
char *file1,*file2,buf[2];
file1=argv[1];
file2=argv[2];
printf("file1=%s file2=%s",file1,file2);
fd1=open(file1,O_RDONLY,0777);
fd2=creat(file2,0777);
while(i=read(fd1,buf,1)>0)
write(fd2,buf,1);
remove(file1);
close(fd1);
close(fd2);
}




C

Related
fatal and non fatal error in c Code Example fatal and non fatal error in c Code Example
two way communication between child and parent processes in C using pipes Code Example two way communication between child and parent processes in C using pipes Code Example
Uri/beecrowd problem no - 1099 solution in C Code Example Uri/beecrowd problem no - 1099 solution in C Code Example
c how to include variables of other c file Code Example c how to include variables of other c file Code Example
e sharm card jobkhozo.com Code Example e sharm card jobkhozo.com Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10