How to use Fgets () function and Precautions (notes) __ function

Source: Internet
Author: User

Fgets () function: for reading file strings

Header files: include <stdio.h>

Function Description: The fgets () function is used for reading characters from the file referred to in the parameter stream to the memory space referred to by parameter s, knowing that line breaks, reading to the end of the file, or reading the size-1 character, and then adding null as the end of the string.


Note that the gets function does not specify the size of the input character, and if the input character is greater than the length of the array, the memory is out of bounds, and the Fgets function can automatically intercept characters based on the length of the definition array, eliminating the pitfalls

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.