C file operations (all)

Source: Internet
Author: User
Tags constant definition rewind
1 C file operations
 
File

Basic concepts of Files
The so-called "file" refers to an ordered set of related data. This dataset has a name called a file name. In fact, we have used files many times in the previous chapter, such as source program files, target files, executable files, library files (header files), and so on. Files usually reside on external media (such as disks) and are only transferred to the memory during use. Files can be classified from different angles. From the user's perspective, files can be divided into common files and device files.

A common file is an ordered dataset that resides on a disk or other external media. It can be a source file, a target file, or an executable program. It can also be a set of raw data to be input and processed, or a set of output results. Source files, target files, and executable programs can be called program files, and input and output data can be called data files.

A device file is an external device associated with a host, such as a display, printer, or keyboard. In the operating system, external devices are also managed as files, and their input and output are equivalent to reading and writing disk files. Generally, a display is defined as a standard output file. Generally, information displayed on the screen is output to the standard output file. For example, the previously used printf function putchar is the output type. The keyboard is usually designated as a standard input file. inputting on the keyboard means inputting data from the standard input file. Scanf and getchar functions belong to this type of input.

From the file encoding method, files can be divided into two types: ASCII code files and binary code files.

An ASCII file is also called a text file. When a file is stored on a disk, each character corresponds to one byte and is used to store the corresponding ASCII code. For example, the storage format of hundreds of thousands is:
ASC: 00110101 00110110 00110111 00111000

Decimal code: 5 6 7 8 occupies 4 bytes in total. The ASCII code file can be displayed by characters on the screen. For example, the source code file is an ASCII file, and the doscommand TYPE can be used to display the file content. Because it is displayed by characters, you can read the file content.

Binary files are stored in binary encoding. For example, the storage format of hundreds of thousands is: 5678 00010110 occupies only two bytes. Although a binary file can be displayed on the screen, its content cannot be understood. When processing these files, the C system treats them as byte streams and does not differentiate the types. The start and end of the input and output streams are only controlled by the program, not by physical symbols (such as carriage returns. Therefore, this type of file is also called a "streaming File ".

This chapter describes how to open, close, read, write, and locate streaming files. The file Pointer Points to a file using a pointer variable in C language. This pointer is called a file pointer. The file pointer can be used to perform various operations on the files it refers. The definition description FILE pointer is generally in the format of FILE * pointer variable identifier, where FILE should be capitalized, which is actually a structure defined by the system, this structure contains the file name, File status, and current file location. You do not have to worry about the details of the FILE structure when writing the source program. For example, FILE * fp indicates that fp is a pointer variable pointing to the FILE structure. You can use fp to find the structure variable that stores the information of a FILE, and then find the FILE according to the information provided by the structure variable, perform operations on files. In general, fp is also called a pointer to a file. Open and Close a file before performing read/write operations. Opening a file is actually about creating information about the file and directing the file pointer to the file for other operations. If the file is closed, the connection between the pointer and the file is closed, and operations on the file are prohibited.

In C, file operations are performed by library functions. This chapter describes the main file operation functions.

File opening function fopen

The fopen function is used to open a file. The call is generally in the form of: file pointer name = fopen (file name, using the file method) where, "FILE pointer name" must be a pointer variable described as FILE type, and "FILE name" must be the name of the opened FILE. "File Usage" refers to the file type and operation requirements. The "file name" is a String constant or a string array. For example:
FILE * fp;
Fp = ("file a", "r ");
It means to open file a in the current directory, only allow "read" operations, and direct fp to the file.

   
   
 

2 C file operations
 
Another example:
FILE * fphzk
Fphzk = ("c: // hzk16'," rb ")
It means to open the file hzk16 under the root directory of drive C, which is a binary file and only allows read operations in binary mode. The first of the two Backslash "//" represents the escape character, and the second represents the root directory. There are 12 methods to use files. Their symbols and meanings are given below.
File Usage
"Rt" only opens a text file and only supports reading data.
"Wt" only writes to open or create a text file, only data can be written
Append "at" to open a text file and write data at the end of the file.
"Rb" is used to open a binary file and only read data.
"Wb" only writes to open or create a binary file, only data can be written
Append "AB" to open a binary file and write data at the end of the file.
"Rt +" reads and writes to open a text file, allowing reading and writing
"Wt +" reads and writes to open or create a text file, allowing reading and writing
"At +" to open a text file, allow reading, or append data to the end of the file
"Rb +" reads and writes a binary file, allowing reading and writing
"Wb +" to open or create a binary file and allow reading and writing
"AB +" reads and writes to open a binary file, allowing reading or appending data at the end of the file

The usage of files is described as follows:
1. The file is comprised of r, w, a, t, B, and +. The meanings of each character are as follows:
R (read): read
W (write): write
A (append): append
T (text): text File, can be omitted without writing
B (banary): Binary File
+: Read and Write

2. When you use "r" to open a file, the file must already exist and can only be read from the file.

3. A file opened with "w" can only be written to this file. If the opened file does not exist, the file is created with the specified file name. If the opened file already exists, delete the file and create a new file.

4. to append new information to an existing file, you can only open the file in "a" mode. However, this file must exist at this time; otherwise, an error will occur.

5. If an error occurs when opening a file, fopen returns a NULL pointer value. In the program, this information can be used to determine whether to complete the file opening and handle it accordingly. Therefore, the following sections are commonly used to open files:
If (fp = fopen ("c: // hzk16", "rb") = NULL)
{
Printf ("/nerror on open c: // hzk16 file! ");
Getch ();
Exit (1 );
}
The meaning of this program is that if the returned pointer is null, it indicates that the hzk16 file under the root directory of the C drive cannot be opened, the message "error on open c:/hzk16file!" is displayed !", The next line of getch () is used to input a character from the keyboard, but is not displayed on the screen. Here, the role of this row is to wait. The program continues to be executed only when you press one key from the keyboard. Therefore, you can use this wait time to read the error message. Press the key and execute exit (1) to exit the program.

6. when reading a text file into the memory, you need to convert the ASCII code into a binary code. When writing the file into a disk as text, you also need to convert the binary code into an ASCII code, therefore, it takes a lot of time to read and write text files. This conversion does not exist for reading/writing binary files.

7. The standard input file (keyboard), standard output file (Display), and standard error output (error information) are opened by the system and can be used directly. Once the fclose file function is used, the application closes the file function to avoid errors such as file data loss.

Fclose Function

The call method is fclose (File pointer). For example:
Fclose (fp); when the file close operation is completed normally, the return value of the fclose function is 0. If a non-zero value is returned, an error occurs. File read/write is the most common file operation.

The C language provides a variety of functions for reading and writing files:
· Character read/write functions: fgetc and fputc
· String read/write functions: fgets and fputs
· Data block read/write functions: freed and fwrite
· Formatted read/write functions: fscanf and fprinf

The following sections describe them respectively. The above functions must contain the header file stdio. h. The character read/write functions fgetc and fputc are read/write functions in bytes. One character can be read from or written to a file each time.

   
   
 

3 C file operations
 
I. Read character function fgetc

The fgetc function is used to read a character from a specified file. The function is called in the form of: character variable = fgetc (File pointer); for example: ch = fgetc (fp ); it means reading a character from the open file fp and sending it to ch.

The usage of the fgetc function is described as follows:
1. In the fgetc function call, the read file must be opened in read or read/write mode.

2. The result of reading a character can also be not assigned to the character variable, for example, fgetc (fp). However, the read characters cannot be saved.

3. There is a position pointer inside the file. It is used to point to the current read/write bytes of the file. When a file is opened, the pointer always points to the first byte of the file. After the fgetc function is used, the position pointer moves one byte backward. Therefore, you can use the fgetc Function Multiple times to read multiple characters. Note that the file pointer is not the same as the position pointer inside the file. The file Pointer Points to the entire file and must be defined in the program. As long as no value is assigned again, the file pointer value remains unchanged. The position pointer inside the file is used to indicate the current read/write position inside the file. Every read/write time, the pointer moves backward. It does not need to be defined in the program, but is automatically set by the system.

[Example 10.1] Read the file e10-1.c and output on the screen.
# Include <stdio. h>
Main ()
{
FILE * fp;
Char ch;
If (fp = fopen ("e10_1.c", "rt") = NULL)
{
Printf ("Cannot open file strike any key exit! ");
Getch ();
Exit (1 );
}
Ch = fgetc (fp );
While (ch! = EOF)
{
Putchar (ch );
Ch = fgetc (fp );
}
Fclose (fp );
}
The function of this program is to read characters from files one by one and display them on the screen. The program defines the file pointer fp, opens the file "e10_1.c" as a read text file, and points fp to the file. If an error occurs while opening the file, a prompt is displayed and the program is exited. The program first reads a character in line 3 and then enters the loop. As long as the read character is not the end mark of the file (each file has an end mark EOF), the character is displayed on the screen, read the next character. Each time a file is read, the position pointer inside the file moves one character backward. When the file ends, the Pointer Points to EOF. Execute this program to display the entire file.

Ii. Write the character function fputc

The fputc function writes a character to a specified file. The function is called in the form of fputc (character quantity, file pointer, the number of characters to be written can be a character constant or variable, for example, fputc ('A', fp). It means to write character a to the file pointed to by fp.

The usage of fputc functions should also be described as follows:
1. the written file can be opened by using, writing, reading, and writing. When an existing file is opened by writing or reading/writing, the original file content will be cleared, the write character starts from the beginning of the file. To retain the content of the original file and store the characters to be written at the end of the file, the file must be opened in append mode. If the file to be written does not exist, the file is created.

2. Each time a character is written, the internal position pointer of the file moves one byte backward.

3. The fputc function has a return value. If the write is successful, the written character is returned. Otherwise, an EOF is returned. This can be used to determine whether the write is successful.

[Example 10.2] enter a line of characters from the keyboard, write a file, and read the file content and display it on the screen.
# Include <stdio. h>
Main ()
{
FILE * fp;
Char ch;
If (fp = fopen ("string", "wt +") = NULL)
{
Printf ("Cannot open file strike any key exit! ");
Getch ();
Exit (1 );
}
Printf ("input a string:/n ");
Ch = getchar ();
While (ch! = '/N ')
{
Fputc (ch, fp );
Ch = getchar ();
}
Rewind (fp );
Ch = fgetc (fp );
While (ch! = EOF)
{
Putchar (ch );
Ch = fgetc (fp );
}
Printf ("/n ");
Fclose (fp );
}
The second line in the program opens the string file in the form of reading and writing text files. The program reads a character from the keyboard in line 3 and then enters the loop. When the character is not a carriage return, the program writes the character into the file and continues to read the next character from the keyboard. Each time one character is entered, the internal position pointer of the file moves one byte backward. After writing, the pointer is directed to the end of the file. To read the file from the beginning, you must move the pointer to the file header. The program's 19th-line rewind function is used to move the internal position pointer of the file referred to by fp to the file header. Lines 20th to 25 are used to read a row of content from the file.

[Example 10.3] copy the file marked by the previous file name in the command line parameter to the file marked by the last file name, if there is only one file name in the command line, the file will be written to the standard output file (Display.

   
   
 

4 C file operations
 
# Include <stdio. h>
Main (int argc, char * argv [])
{
FILE * fp1, * fp2;
Char ch;
If (argc = 1)
{
Printf ("have not enter file name strike any key exit ");
Getch ();
Exit (0 );
}
If (fp1 = fopen (argv [1], "rt") = NULL)
{
Printf ("Cannot open % s/n", argv [1]);
Getch ();
Exit (1 );
}
If (argc = 2) fp2 = stdout;
Else if (fp2 = fopen (argv [2], "wt +") = NULL)
{
Printf ("Cannot open % s/n", argv [1]);
Getch ();
Exit (1 );
}
While (ch = fgetc (fp1 ))! = EOF)
Fputc (ch, fp2 );
Fclose (fp1 );
Fclose (fp2 );
}
This program is the main function with parameters. The program defines two file pointers: fp1 and fp2, respectively pointing to the file given in the command line parameters. If the command line parameter does not provide a file name, a prompt is displayed. Line 2 of the program indicates that if only one file name is given, fp2 is directed to the standard output file (Display ). The program reads the characters in file 1 one by one with loop statements from lines 2 to 28 and then sends them to file 2. During the re-running, a file name (the file created in example 10.2) is provided, so stdout is output to the standard output file, that is, the file content is displayed on the display. In the third run, two file names are provided, so the content in the string is read and written to OK. The doscommand type can be used to display the OK content: String read/write functions fgets and fputs

1. The fgets function of the string reading function reads a string from a specified file to a character array. The function is called in the form of fgets (character array name, n, file pointer); where n is a positive integer. It indicates that the number of characters read from a file cannot exceed n-1. Add the string end sign '/0' after the last character '. For example, fgets (str, n, fp); reads n-1 characters from the file indicated by fp and sends them to the str array.
[Example 10.4] Read a 10-character string from the e10_1.c file.
# Include <stdio. h>
Main ()
{
FILE * fp;
Char str [11];
If (fp = fopen ("e10_1.c", "rt") = NULL)
{
Printf ("Cannot open file strike any key exit! ");
Getch ();
Exit (1 );
}
Fgets (str, 11, fp );
Printf ("% s", str );
Fclose (fp );
}
In this example, a string array of 11 characters is defined. After the e101.c file is opened in the text file mode, 10 characters are read from it and sent to the str array, add '/0' to the last cell of the array, and then display the output str array on the screen. The output 10 characters are the first 10 characters in the sample 10.1 program.

Fgets functions are described as follows:
1. If a linefeed or EOF is encountered before reading n-1 characters, the reading is complete.
2. The fgets function also has a return value, whose return value is the first address of the character array.

Ii. Write the string function fputs

The fputs function is used to write a string to a specified file. The call form is fputs (string, file pointer). The string can be a String constant or a character array name, or pointer variable, for example:
Fputs ("abcd", fp );
The meaning is to write the string "abcd" into the file specified by fp. [Example 10.5] append a string to the string created in example 10.2.
# Include <stdio. h>
Main ()
{
FILE * fp;
Char ch, st [20];
If (fp = fopen ("string", "at +") = NULL)
{
Printf ("Cannot open file strike any key exit! ");
Getch ();
Exit (1 );
}
Printf ("input a string:/n ");
Scanf ("% s", st );
Fputs (st, fp );
Rewind (fp );
Ch = fgetc (fp );
While (ch! = EOF)
{
Putchar (ch );
Ch = fgetc (fp );
}
Printf ("/n ");
Fclose (fp );
}
In this example, a string must be added at the end of the string file. Therefore, the string file is opened in the append-read-write mode in line 2 of the program. Enter a string and use the fputs function to write the string to the file. In the 15 lines of the program, use the rewind function to move the internal position pointer of the file to the beginning of the file. Then go to the loop to display all the content in the current file one by one.

Data Block read/write functions fread and fwrite

The C language also provides read/write functions for the entire data block. It can be used to read and write a group of data, such as an array element and a value of a structure variable. The call Method for reading data block functions is fread (buffer, size, count, fp). The call Method for writing data block functions is fwrite (buffer, size, count, fp); buffer is a pointer. In the fread function, it indicates the first address to store the input data. In the fwrite function, it indicates the first address of the output data. Size indicates the number of bytes of the data block. Count indicates the number of data blocks to read and write. Fp indicates the file pointer.

   
   
 

5 C file operations
 
For example:
Fread (fa, fp); it means that four bytes (a real number) are read each time from the file indicated by fp and sent to the real array fa for five consecutive reads, read 5 real numbers into fa.
[Example 10.6] input two student data from the keyboard, write them into a file, and read the data of the two students on the screen.
# Include <stdio. h>
Struct stu
{
Char name [10];
Int num;
Int age;
Char addr [15];
} Boya [2], boyb [2], * pp, * qq;
Main ()
{
FILE * fp;
Char ch;
Int I;
Pp = boya;
Qq = boyb;
If (fp = fopen ("stu_list", "wb +") = NULL)
{
Printf ("Cannot open file strike any key exit! ");
Getch ();
Exit (1 );
}
Printf ("/ninput data/n ");
For (I = 0; I <2; I ++, pp ++)
Scanf ("% s % d % s", pp-> name, & pp-> num, & pp-> age, pp-> addr );
Pp = boya;
Fwrite (pp, sizeof (struct stu), 2, fp );
Rewind (fp );
Fread (qq, sizeof (struct stu), 2, fp );
Printf ("/n/nname/tnumber age addr/n ");
For (I = 0; I <2; I ++, qq ++)
Printf ("% s/t % 5d % 7d % s/n", qq-> name, qq-> num, qq-> age, qq-> addr );
Fclose (fp );
}
In this example, the program defines a structure stu, indicating two arrays boya and boyb, and two structure pointer variables pp and qq. Pp points to boya, qq points to boyb. Line 2 of the program opens the binary file "stu_list" in read/write mode, enters two student data, writes it to the file, and moves the internal position pointer of the file to the beginning of the file, after reading two pieces of student data, it is displayed on the screen.

Formatting read/write functions fscanf and fprintf

The fscanf function and fprintf function are similar to the functions of the scanf and printf functions used earlier. They are both formatted read/write functions. The difference between the fscanf function and fprintf function is that the Read and Write objects are not keyboard and display, but disk files. The call formats of these two functions are: fscanf (File pointer, Format String, input table column); fprintf (File pointer, Format String, output table column); for example:
Fscanf (fp, "% d % s", & I, s );
Fprintf (fp, "% d % c", j, ch );
The fscanf and fprintf functions can also be used to solve the problem in the case of 10.6. Shows the modified program in example 10.7.
[Example: 10.7]
# Include <stdio. h>
Struct stu
{
Char name [10];
Int num;
Int age;
Char addr [15];
} Boya [2], boyb [2], * pp, * qq;
Main ()
{
FILE * fp;
Char ch;
Int I;
Pp = boya;
Qq = boyb;
If (fp = fopen ("stu_list", "wb +") = NULL)
{
Printf ("Cannot open file strike any key exit! ");
Getch ();
Exit (1 );
}
Printf ("/ninput data/n ");
For (I = 0; I <2; I ++, pp ++)
Scanf ("% s % d % s", pp-> name, & pp-> num, & pp-> age, pp-> addr );
Pp = boya;
For (I = 0; I <2; I ++, pp ++)
Fprintf (fp, "% s % d % s/n", pp-> name, pp-> num, pp-> age, pp->
Addr );
Rewind (fp );
For (I = 0; I <2; I ++, qq ++)
Fscanf (fp, "% s % d % s/n", qq-> name, & qq-> num, & qq-> age, qq-> addr );
Printf ("/n/nname/tnumber age addr/n ");
Qq = boyb;
For (I = 0; I <2; I ++, qq ++)
Printf ("% s/t % 5d % 7d % s/n", qq-> name, qq-> num, qq-> age,
Qq-> addr );
Fclose (fp );
}
Compared with example 10.6, in this program, the fscanf and fprintf functions can read and write only one structural array element at a time. Therefore, they use loop statements to read and write all array elements. Note that the pointer variable pp, qq, has changed their values cyclically, so they are re-assigned the first address of the array in line 25 and 32 of the program.

Random file read/write

The read and write methods for files are sequential read and write, that is, the read and write files can only start from the beginning, read and write data sequentially. However, in practice, it is often required that a specified part of the read-only file be written. To solve this problem, the position pointer inside the file is moved to the location where the file needs to be read and written before reading and writing. This read and writing is called random read and write. The key to achieving random read/write is to move the location pointer as required, which is called file location. There are two main functions used to locate and move the internal position pointer of a file, namely the rewind function and the fseek function.

The rewind function has been used multiple times before and is called in the form of rewind (File pointer). Its function is to move the position pointer inside the file to the beginning of the file. The following describes
Fseek function.

The fseek function is used to move the internal position pointer of a file. The call form is fseek (File pointer, displacement, starting point). The "file Pointer" points to the object to be moved. "Displacement" indicates the number of bytes to move. The displacement is long data, so that no error occurs when the file length is greater than 64 KB. When a constant is used to represent the displacement, the suffix "L" is required ". The "Starting Point" indicates where to start the calculation of the displacement. There are three defined starting points: the first part of the file, the current position, and the end of the file.

   
   
 

6 C file operations
 
The representation is shown in Table 10.2.
Starting point represents a symbolic number.
--------------------------
First SEEK-SET 0
Current location SEEK-CUR 1
SEEK-END 2 at the END of the file
For example:
Fseek (fp, 100L, 0); it means to move the position pointer to the first 100 bytes away from the file. It must be noted that the fseek function is generally used for binary files. In a text file, the location of the calculation is often incorrect because the conversion is required. After moving the pointer, you can use any of the read/write functions described earlier. Generally, fread and fwrite functions are commonly used to read and write data blocks. The following example describes the random read/write operations of a file.

[Example 10.8] read the data of the second student in the student file stu list.
# Include <stdio. h>
Struct stu
{
Char name [10];
Int num;
Int age;
Char addr [15];
} Boy, * qq;
Main ()
{
FILE * fp;
Char ch;
Int I = 1;
Qq = & boy;
If (fp = fopen ("stu_list", "rb") = NULL)
{
Printf ("Cannot open file strike any key exit! ");
Getch ();
Exit (1 );
}
Rewind (fp );
Fseek (fp, I * sizeof (struct stu), 0 );
Fread (qq, sizeof (struct stu), 1, fp );
Printf ("/n/nname/tnumber age addr/n ");
Printf ("% s/t % 5d % 7d % s/n", qq-> name, qq-> num, qq-> age,
Qq-> addr );
}
The stu_list file has been created by the program in example 10.6. This program reads the data of the second student by random reading. The program defines boy as a stu type variable, and qq as a pointer to boy. Open the file by reading the binary file, and the program moves the file location pointer in line with 22nd. The value of I is 1, which indicates that starting from the file header, the length of an stu type is moved, and then the data read is the data of the second student.

File Detection Functions

The following file detection functions are commonly used in C language.
1. File end detection function feof function call format: feof (File pointer );
Function: determines whether the object is at the end of the object. If the object ends, the return value is 1. Otherwise, the return value is 0.

Ii. file read/write error detection function ferror function call format: ferror (File pointer );
Function: checks whether an error occurs when a file is read or written using various input/output functions. If the return value of ferror is 0, it indicates no error; otherwise, it indicates an error.

3. Set the file error mark and file end sign to 0. clearerr function call format: clearerr (File pointer );
Function: This function is used to clear the error mark and end mark of a file so that they are 0 values.

C library file

C system provides a wide range of system files, called library files. C library files are divided into two types, one is the extension ". h "file, called the header file, has been used many times in the preceding include command. The ". h" file contains constant definition, type definition, macro definition, function prototype, and various compilation and selection settings. Another type is the function library, which includes the target code of various functions for users to call in the program. When a library function is called in a program, the ". h" file of the function prototype must be included before the function is called.
All database functions are provided in the appendix.
ALLOC. H indicates memory management functions (such as allocation and release ).
ASSERT. H defines assert debugging macros.
BIOS. H describes the various functions that call the IBM-PC rom bios subroutine.
CONIO. H indicates that each function of the I/O subprogram of the DOS console is called.
CTYPE. H contains the name class information about character classification and conversion (such as isalpha and toascii ).
DIR. H contains the Directory and path structures, macro definitions, and functions.
DOS. H defines and describes some constants and functions called by MSDOS and 8086.
ERRON. H defines the entrustment of the error code.
FCNTL. H defines the symbolic constant used to connect to the open Library subroutine.
FLOAT. H contains some parameters and functions related to floating point operations.
GRAPHICS. H describes various functions related to graphic functions, constant definitions of graphic error codes, various color values of different drivers, and some special structures used by functions.
IO. H contains the structure and description of low-level I/O subprograms.
LIMIT. H contains environment parameters, compilation time limits, number ranges, and other information.
MATH. H describes the mathematical operation functions, and defines the huge val macro, which describes the special structures used by matherr and matherr subprograms.
MEM. H indicates some memory operation functions (most of them are also described in STRING. H ).
PROCESS. H describes the various functions of PROCESS management, spawn... And EXEC... Function structure description.
SETJMP. H defines the jmp buf types used by longjmp and setjmp functions.
SHARE. H defines the parameters of the file sharing function.
SIGNAL. H defines the SIG [ZZ (Z] [ZZ)] IGN and SIG [ZZ (Z] [ZZ)] DFL constants, indicating the rajse and signal functions.
STDARG. H defines the macro of the read function parameter table. (Such as vprintf and vscscarf functions ).
STDDEF. H defines some common data types and macros.
STDIO. H defines the standard and extended types and macros defined by Kernighan and Ritchie in Unix System V. Standard I/O predefined streams: stdin, stdout, and stderr are also defined to describe the I/O Stream subprograms.
STDLIB. H describes some common subprograms, such as conversion subprograms and search/sort subprograms.
STRING. H describes some STRING operations and memory operation functions.
SYS/STAT. H defines some symbolic constants used to open and create files.
SYS/TYPES. H describes the ftime function and timeb structure.
SYS/TIME. H defines the time type TIME [ZZ (Z] [ZZ)] t.
TIME. H defines the structure of the TIME conversion subprograms asctime, localtime, and gmtime, the types used by ctime, difftime, gmtime, localtime, and stime, and provides prototype of these functions.
VALUE. H defines some important constants, including those dependent on machine hardware and which are described for compatibility with Unix System V, including floating point and double precision VALUE ranges.

 

Related Article

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.