In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What are the functions of the fgetc function? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
The function of the fgetc function is to read a character from a specified file, which requires that the file be opened either by reading or writing or by appending.
Type, only write mode can not be read.
Fgetc is a function in computer C language. It means to read a character from the file pointed to by the file pointer stream. After reading a byte, the cursor position moves back one byte. Format: int fgetc (FILE * stream);.
The function of the fgetc () function is to read a character from the file specified by the file pointer, and the ASCII value of the character is the return value of the function. If the return value is EOF, it means the end of the file, and EOF is the end of the file, with a value of-1.
The statement "c=fgetc (fp);" reads a character co-existing in the c variable from the file specified by the file pointer fp, where c is a character variable. Before using the fgetc () function call, the file that needs to be read must be opened as read or read / write, and the file should already exist.
The location of the read operation is also determined by the file internal location pointer. For an existing file, when the file is opened, the file internal location pointer points to the first byte of the file. At this time, calling the fgetc () function reads the first byte of the character, and after reading a byte, the position pointer will automatically move backward one byte, so calling the fgetc () function again will read the second character. You can read every character of the file by calling this function continuously, and you can use EOF to determine whether the end of the file has been reached.
Content description: the function returns the next character from the current position of the input stream stream and increases the file location indicator. The character is read as an unsigned character and converted to an integer value.
If you reach the end of the file or encounter a read error, you will return EOF. Because EOF is a valid integer value, when you manipulate binaries, you must use the feof function to check the end of the file. You must also use the ferror function for error checking.
Reference: fputc (); getc (); putc (); fopen ().
The function of the fgetc () function is to read a character from the file specified by the file pointer, and the ASCII value of the character is the return value of the function. If the return value is EOF, it means the end of the file, and EOF is the end of the file, with a value of-1.
The statement "c=fgetc (fp);" reads a character co-existing in the c variable from the file specified by the file pointer fp, where c is a character variable. Before using the fgetc () function call, the file that needs to be read must be opened as read or read / write, and the file should already exist.
The location of the read operation is also determined by the file internal location pointer. For an existing file, when the file is opened, the file internal location pointer points to the first byte of the file. At this time, calling the fgetc () function reads the first byte of the character, and after reading a byte, the position pointer will automatically move backward one byte, so calling the fgetc () function again will read the second character. You can read every character of the file by calling this function continuously, and you can use EOF to determine whether the end of the file has been reached.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.