-->

What are the Unix system calls for I/O?

- creat(name, permissions) – Used to create a file with the name and mode specified. Here, permission would be a number. 0666 means read write permissions.

- open(name, mode) – Used to open a file name in the mode (read or write) specified.0 is for opening in read mode, 1 for writing and 2 for both.

- close(fd) – Close a opened file.

- unlink(fd) – Delete a file.

- read(fd, buffer, n_to_read) – Read data from a file.

- write(fd, buffer, n_to_write) - write data from to a file.

- lseek(fd, offest, whence) - Move the read/write pointer to the specified location.


What are the UNIX system calls for I/O?

The following are the UNIX system calls for I/O:

- Open: to open a file.

Syntax:



- Create: To create a file.

Syntax:


- Close: To close a file.

Syntax:


- Read: To read data from a file that is opened.

Syntax:


- Write: To write data to a file that is opened.

Syntax:


- Lseek: To position the file pointer at given location in the file.

Syntax:


- Dup: To make a duplicate copy of an existing file descriptor.

Syntax:


- Fcntl: To make the changes to the properties of an open file.

Syntax: