In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "what is the header file commonly used in C language". The editor shows you the operation process through an actual case, and the operation method is simple, fast and practical. I hope this article "what is the header file commonly used in C language" can help you solve the problem.
1. The input and output functions, types and macros are defined, and the functions account for almost 1 / 3 of the standard library.
(1) File access.
FILE * fopen ("filename", "mode"):
Open the file with the address' filename' in mode mode and return the file pointer.
The access mode is mainly "r": read-only; "w": write-only and delete existing content; "a": append, append at the end
"r +", "w +": read and write; "a +" append, the above end with "b": binary file operation.
Note: where r is the open file, and w is created (if the file does not exist); w overwrites the original content, and an is appended to the end of the original file.
Int fclose (FILE * f):
Release buffer data and close the stream.
FILE * freopen ("filename", "mode", FILE * f):
Open the file with the address' filename' in mode mode and associate the file with stream f2.
Writes all data that has been written to the buffer but not in the file to the file.
(2) binary input / output
Read n objects of length size from f and put them into the array pointed to by ptr.
Read n objects of length size from the ptr pointing array and write them to f.
Note: note that for write and read objects, both reading and writing are for file stream f.
(3) unformatted input / output
Int fgetc/getc (FILE * f):
Returns the next character of stream f, reaches the end of the file / an error occurs, returns EOF.
Int fputc/putc (int c, FILE * f)
Int fgets (char * smenint njime * f):
Read 1 character in f into the array s.
Int fputs (const char * s fee * f):
Output the string s to the stream.
Scanf/fscanf/sscanfprintf/fprintf/sprintf
Note: without fUnip s, it is a standard input / output function of format string, input / output to terminal / screen; printf (const char * format,...)
Add s, input / output to the string. Sprintf (char * s ·Const char * format,...)
Add f, input / output to the file stream. Fprintf (FILE * fje Const char * format,...)
Returns the current pointer position. Returns-1L on error.
Int fseek (FILE * f ·long offset,int origin):
Sets the current stream f pointer position to offset characters after: origin. Origin has: SEEK_SET: file start location; SEEK_CUR pointer current location, SEEK_END: file end location.
Void rewind (FILE * f)
The pointer returns the start position of the file, which is equivalent to: fseek (fjori0L _ SEEKEMSTET)
Int fgetpos (FILE * freguency)
Records the current position of the pointer to * p for use by the fsetpos function.
Int fsetpos (FILE * fjre Const * p)
(6) error handling and file operation
Indicates that the file ends, returns 0 all the time, and returns a non-0 value at the end.
If an error indicator associated with f is set, a non-zero value is returned.
Int remove (char * filename)
Deletes the file at the specified location.
Int rename (const char * oldname,const char * newname)
Change the file name, otherwise a non-zero value is returned.
FILE * tmpfile (void)
Create a temporary file, 'wb+' mode, which is automatically deleted when it is closed or when the program ends normally
two。 Divided into two groups, beginning with a set of str and beginning with a set of mem (this set of functions are also defined in, not all compilers)
(1) str
Char * strcpy (char * dest, const char * src)
Copy the string src to the string dest (including'\ 0') and return dest
Char * strncpy (char * dest, const char * src,n)
Copy the first n characters in src to dest and return dest. If there are less than n characters, fill in'\ 0'.
Char * strcat (char * dest, const char * src); char * strncat (char * dest, const char * src,n)
After src is connected to dest; the first n characters in src are connected to dest.
Int strcmp (const char * S1, const char * S2); int strncmp (const char * S1, const char * S2); compare S1 with S2
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.