Dark Horse programmer--c Language learning experience--pointers

Source: Internet
Author: User

Dark Horse programmer--c Language learning experience--pointers

-------Java training , Android training ,iOS training ,. Net Training , look forward to communicating with you! -------

1. Open File
fopen (file name, open mode);
For example:
FILE *FP = fopen ("A1", "R"); Returns a pointer to the file (the file's first address in the memory buffer)
The fopen function inverse value is a pointer to a A1 file, usually assigned to a pointer variable
about the file name A1 can also be a "path + file name" C:\abc.txt
--------------------------------------------------------------
Open in the way:
R Read W write a append
r+ w+ A + read-write way to open files
t Open text file
b Open binary file
--------------------------------------------------------------
If open fails, the fopen function returns a null pointer null
if ((Fp=fopen ("File1", "R")) ==null) {
printf ("Open failed! ");
exit (0);
}
2. Close File
close the file with the close function, the general form of the call to the Fclose function is
fclose (file pointer);
For example:
fclose (FP); Fp=0;
Note: If you do not close the file will lose data!!!!

-------Java training , Android training ,iOS training ,. Net Training , look forward to communicating with you! -------

Dark Horse programmer--c Language learning experience--pointers

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.