Wednesday, 6 August 2014

What are the Unix system calls for I/O?

      
Ø  open(pathname,flag,mode) - open file
Ø  creat(pathname,mode) - create file
Ø  close(filedes) - close an open file
Ø  read(filedes,buffer,bytes) - read data from an open file
Ø  write(filedes,buffer,bytes) - write data to an open file
Ø  lseek(filedes,offset,from) - position an open file
Ø  dup(filedes) - duplicate an existing file descriptor
Ø  dup2(oldfd,newfd) - duplicate to a desired file descriptor
Ø  fcntl(filedes,cmd,arg) - change properties of an open file
Ø  ioctl(filedes,request,arg) - change the behaviour of an open file
The difference between fcntl anf ioctl is that the former is intended for any open file, while the latter is for device-specific operations.

No comments:

Post a Comment