The basic course of C language (iii) input and output functions and control flow statements (13)

Source: Internet
Author: User

2.close () function
The close () function closes the file opened by the open () function, which is invoked in the form of an int-close (int handle);
This function closes the file description Word handle the attached file.
Second, read and write functions
1.read () function
The call format for the read () function is:
int read (int handle, void *buf, int count);
The read () function reads the count bytes into the buffer referred to in BUF from the handle (file descriptor) file, the return value is the actual number of bytes read, and return 1 indicates an error. A return of 0 indicates the end of the file.
2.write () function
The call format for the write () function is:
int write (int handle, void *buf, int count);
The write () function writes count bytes from the buffer pointed to by the BUF to the handle-connected file, and the return value is the number of bytes actually written.

Third, random positioning function
1.lseek () function
The call format for the Lseek () function is:
int Lseek (int handle, long offset, int fromwhere);
This function locates the file position pointer attached to the handle, with the same functionality and usage as the fseek () function.
2.tell () function
The call format for the tell () function is: long tell (int handle);
This function returns the current location pointer of the file attached to the handle, with the same functionality and usage as Ftell ().

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.