answersLogoWhite

0


Best Answer

#include<sys/types.h>

#include<sys/stat.h>

#include<fcntl.h>

#include<stdio.h>

#include<unistd.h>

#include<string.h>

int main()

{

int fd1,fd2;

char name1[100],name2[100];

char str[6];

int n;

printf("enter name of file to move");

scanf("%s",name1);

printf(enter new location);

scanf("%s",name2);

fd1=open(name1,O_RDONLY);

fd2=open(name2,O_WRONLY);

while(1)

{

n=read(fd1,str,sizeof(str));

printf("%s \n",str);

if(n==0)

break;

write(fd2,str,n);

}

close(fd1);

close(fd2);

unlink(name1);

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you move a file in UNIX using relative addressing?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you create dummy file in unix?

using touch command of UNIX. syntax touch &lt;filename&gt; will create dummy regular file.


In unix how will you find extension of file using commands?

Unix files do not rely on extensions, therefore there is no command to find them.


The data blocks of a very large file in the Unix file system are allocated using?

an extensioin of indexed allocation


The Unix file contains which kinds of fields?

The Unix file contains which kinds of fields?


Without using cp command you copy file to another file in unix?

The easiest way would be: cat file1 &gt; file2


How do you Find size of a file using c program?

OS-dependent.stat for unix, FindFirstFile for Windows.


What is the system file in Unix?

There is no the system file. There are many files necessary to create a working Unix system.


How do you transfer files from unix to windows?

Unix files can be easily transferred to windows via a network connection either by using FTP or by using Samba. Samba allows a Unix file system to be mounted/shared on a Windows system to look like a windows directory.


Where would you find a host file on a unix server?

The host file in Unix is usually located in the /etc directory.


Is Unix a web browser?

Unix is a text file, not a web browser. :)


What has the author Douglas W Topham written?

Douglas W. Topham has written: 'A system V guide to UNIX and XENIX' -- subject(s): UNIX System V (Computer file), XENIX (Computer file) 'The first book of UNIX' 'UNIX and XENIX' -- subject(s): UNIX (Computer file), XENIX


Which name resolution technique does a UNIX host use?

Host names can be resolved by either using the /etc/hosts file or by using DNS.