The function getchar is defined to be equivalent to GETC (stdin ). the difference between the first two functions is that GETC can be implemented as a macro, whereas fgetc cannot be implemented as a macro. this means three things.
1. The
What is the difference between fgetc, fputc, getc, and putc in C language? getcputc
When I was reading a book, I found these four functions and wanted to know their differences. Results online query found that many people said that fgetc, fputc f
Read the book, found the four functions, want to know their differences. Results Online Search found that many people say that fgetc, FPUTC F represents the file, that is, these two functions are related to files! But a look at their function
fopen (Open file)
Defining functions
FILE * fopen(const char * path,const char * mode);
Function description
Parameter The path string contains the file path and filename to open, and the parameter mode
C language Getc () function: Reading characters from the streamheader file:
#include
The function getc () is used to extract characters from the stream, and its prototype is as follows:
int getc (FILE *stream);
The
Buffer-related operations are common operations that allow input and output of our characters. In fact, after accessing the operating system and compilation principles, it seems that the computer is actually processing strings. Today we will
C language Getc () function: Reading characters from the streamheader file:
#include
The function getc () is used to extract characters from the stream, and its prototype is as follows:
int getc (FILE *stream);
The
Input/Output Function Family
The family name can be used for all streams only for stdin and stdout
Getchar Character Input fgetc, GETC getchar
Putchar output fputc, putc putchar
Gets text line Input fgets gets
Puts text line output fputs
First, these two functions are not functions in the C standard library,
Int getch (void) // read a character from the standard input. When you enter the character on the keyboard, the screen does not display the character you entered. That is, do
Two original posts: http://www.cnblogs.com/younes/archive/2010/01/05/1639482.html
Http://blog.csdn.net/cxyol/archive/2006/03/18/628324.aspx
FirstTwo functions are not functions in the c Standard Library:
Int getch (void) // read a character from
fopen (Open file)Correlation function Open,fclose
Table header file #include
Defines the function FILE * fopen (const char * path,const char * mode);
The function description parameter path string contains the file path and filename to open, and
Common Linux C functions-File Content operations-general Linux technology-Linux programming and kernel information. For more information, see the following. Clearerr (error flag for clearing file streams)
Feof
Header file # include
Define the
I caught up with the College Entrance Examination in the past two days. I attended the College Entrance Examination in my house, so I didn't come to the garden for a stroll. Today, my college entrance examination is finished and I am idle.
The
Linux-fopen-fclose-fread-fwrite and other functions
Clearerr (error flag for clearing file streams)
Related functions
Feof
Header file
# Include
Define functions
Void clearerr (File * stream );
Function Description
Clearerr () clears the error
# Include
# Include
# Include
Int main (void)
...{
File * In, * out;
Clrscr ();
If (in = fopen ("D:/h1.txt", "R") = NULL)
...{
Printf ("can't open infile! ");
Exit (0 );
}
If (out = fopen ("D:/h2.txt", "W") = NULL)
...{
Printf ("can't open
fopen (Open file)Correlation function Open,fcloseTable header file #include Defines the function FILE * fopen (const char * path,const char * mode);Function description The path string contains the file path and filename to open, and the parameter
fopen (Open file)Correlation function Open,fcloseTable header file #include Defines the function FILE * fopen (const char * path,const char * mode);Function description The path string contains the file path and filename to open, and the parameter
Void clearerr (File * stream); The feof function indicates the error flag used by clearerr () to clear the file stream specified by the stream parameter.Int fclose (File * stream ); Related functions close, fflush, fopen, and setbuf indicate that
The most common operation associated with buffer cache is the input and output operations of characters Getchar,getc,getch,getche,gets series functions.
The first example (relating to GetChar):
Copy Code code as follows:
#include
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.