C library function manual --- stdlib.h, process.h, assert.h, math.h, oose.h, conox.h, stat.h, dos.h, stdio.h, sternal.h,

xiaoxiao2021-03-06  65

Process functions, the function library is stdlib.h, process.hvoid abort () This function writes a termination information in stderr by calling _exit with exit code 3, and is abnormally terminating the program. Non-return value int exec ... loading and run other program int execl (char * arg1, char * argn, char * arg1, ..., char * argn, null) int execle (char * pathname, char * arg0, char * arg1, ..., Char * Argn, ​​NULL, CHAR * ENVP []) int execlp (char * pathname, char * arg0, char * arg1, ..., null) int execlpe (char * pathname, char * arg0, char * arg1, ..., NULL, Char * Envp [] Int Execv (Char * Pathname, Char * Argv []) Int Execve (Char * Pathname, Char * Argv [], Char * Envp []) int execvp (char * pathname, char * argv []) int execvpe (char * pathname, char * argv [], char * envp []) Exec function family is loaded and running the program Pathname, and the parameter arg0 (arg1, arg2, argv [], envp []) passed To the subroutine, error returns -1 In the exec function family, the suffix L, V, P, E are added to the exec, the specified function will have some kind of operational ability with suffix P, the function can take advantage of DOS's PATH variable lookup Subprogram file. L When the number of parameters transmitted in the function is fixed. V When the function passed is not fixed. E, the function passes the specified parameter ENVP, allows the environment where the sub-process is allowed, the sub-process uses the current program.

Void_exit (int stat (int stat (int stat (int stat (int stat (int status) termination of the current program, turn off all files, write the output of the buffer (wait for the output), and call any register "exit function", no return value

INT SPAWN ... Run Program Int Spawnl (int mode, char * pathname, char * arg0, char * arg1, ..., char * argn, null) int Spawnle (int mode, char * pathname, char * arg0, char * arg1, ..., Char * Argn, ​​NULL, CHAR * Envp []) int Spawnlp (int MODE, CHAR * PATHNAME, CHAR * ARG0, CHAR * Arg1, ..., char * argn, null) int Spawnlpe (int mode, char * pathname, Char * arg0, char * arg1, ..., char * argn, null, char * envp []) int Spawnv (int mode, char * pathname, char * argv []) int spawnve (int mode, char * pathname, char * Argv [], char * envp []) int Spawnvp (int mode, char * pathname, char * argv []) int Spawnvpe (int mode, char * pathname, char * argv [], char * envp []) spawn function In the Mode mode, run the subroutine Pathname, and pass the parameter arg0 (arg1, arg2, argv [], envp []) to the subroutine. Error returns -1 Mode to run mode Mode to P_Wait indicate after the subroutine is running Returning this program p_nowait Indicates that the program is running this program (not available) at the time of the subroutine runtime indicates that the operator is added to the spawn function family after this program is exited, and the suffix L, V, P, E are added to the SPAWN, specified When a function will have a suffix P, the function passes the function of DOS using the DOS's PATH. When the number of parameters is fixed. V, the number of parameters passed is not fixed. E, the specified parameter ENVP can be passed to the subroutine, allowing to change the subroutine running environment. When there is no embedding E, the subroutine uses the program of this program .INT System (Char * Command) passes the msdos command command to DOS execution

Converter, the library is Math.h, stdlib.h, ctype.h, float.hchar * ECVT (Double Value, Int NDIGIT, INT * DECPT, INT * SIGN) converts floating point value value VALUE into a string and returns to String Char * FCVT (Double Value, INT NDIGIT, INT * DECPT, INT * SIGN) Converts floating point value VALUE into a string and returns the string char * GCVT (Double Value, Int Ndigit, Char * BUF) will number VALUE Convert into string and stored in BUF, and returned to BUF's pointer char * ULTOA (unsigned long value, char * string, int RADIX) converts unsigned integer values ​​into a string and returns to the string, and RADIX is converted. The base char * LTOA (Long Value, Char * String, INT RADIX) converts long integer values ​​into a string and returns the string, and Radix is ​​the base char * itoa (int value, char * string, int value). Radix converts the integer value into a string to store String, Radix is ​​converted to the base number Double ATOF (Char * nptr) to convert the string NPTR into a double precision, and return to 0ItOi (Char * NPTR) Convert the string NPTR to an integer, return this number, error returns 0long atol (Char * nptr) converts the string nptr to the total number, return this number, error Return 0Double Strtod (Char * Str, Char * * Endptr Converts the string STR to the double precision, returns this number, Long Strtol (CHAR * STR, CHAR ** ENDPTR, INT BASE) converts the string STR to the length, and return this, int toascii (INT C) Returns C The corresponding ASCIIInt Tolower (INT CH) If CH is uppercase letters ('a' - 'Z ') Returns the corresponding lowercase letters (' A '-' Z ') INT _TOLOWER (int CH) Returns CH corresponding lowercase letters (' A '-' Z ') Int Toupper (int CH) If Ch is lowercase letters (' A '-' Z ') Returns the corresponding uppercase letters (' A '-' Z ') int _toupper (int CH) Returns the CHOPPER (' A '-' Z ') diagnostic function, the function library is Assert .h, math.hvoid assert (int test) Macro like an IF statement, if the Test test fails, displays an information and terminates the program, the non-return value void perror (char * string) This function will display the last time The error message, the format is as follows: String string: Error message Char * STRERROR (Char * STR) This function returns the last error message, the format is as follows: String Str: Error message int match (Struct Exception * e) User Modify Mathematics Error return information function (no need to use) Double _matherr (_Mexcep why, char * fun, double * arg1p, double * arg2p, double return) user modified mathematical error returns information function (no need to use)

Input output subroutine, the library is IO.H, Conio.h, Stat.h, dos.h, stdio.h, Signal.hint KBHIT () This function returns the most recently knocked button int FGetChar () from the console ( Keyboard) Read a character and display it on the screen to read a character from the console (keyboard), not displayed on the screen INT PUTCH () Write a character int GETCHAR () from the console ( Keyboard) Read a character, displaying a character INT getChe () from the console (keyboard) on the screen (keyboard) to read a character from the console (keyboard), displayed on the screen INT UNGETCH (INT C) Put the character C Return to the console (keyboard) CGETS (Char * String) Read from the Console (Keyboard) to the string in string int Scanf (char * format [, argument ...]) is read from the console into a string, Assign each parameter, use the BIOS to output int vscanf (char * format, value param) from the console, assign each parameter, using the BIOS to output, parameters to get int CSCANF from Valist Param (Char * Format [, Argument ...] reads a string from the console, assigns each parameter, directly on the control table operation, such as the display, when the display is displayed, the direct write-frequency mode is displayed in the direct write-frequency mode, and displays int SSCANF. Char * string, char * format [, argument, ...]) By string String, assigning Int Vsscanf (char * string, char * format, vlist param), respectively, assigns each parameter for each parameter String, respectively. The parameter acquires int PUTS (Char * String) in VLIST PARAM to send a string string to the console (display), using the BIOS to output VOID CPUTS (Char * String) Send a string string to the console (display), Direct to control Taiwan operation, such as the display is Direct written mode display INT Printf (charr * Format [, argument, ...] Send formatted string Output to console (display) Output INT VPRINTF (Char * Format, Valist Param) Send formatted string Output to console (display) to use BIOS Output, parameter acquires int CPRINTF (Char * Format [, ARGUMENT, ...]) in Valist Param Send format string to output to the console (display), directly on the control table, such as the display is directly written INT VCPRINTF (CHAR * FORMAT, VALIST PARAM) Sends a format string to output to the console (display), directly on the control table, such as the display is shown in direct write-frequency mode, parameter acquired from Valist Param (charr * String, char * format [, argument, ...]) Reconnect the contents of the string String to formatted strings INT vSprintf (Char * String, Char * Format, Valist Param) Rewote the contents of strings String To format the string, the parameter is changed from the Valist Param to change the name of the file oldName to NewNameInt IOCTL (Int Handle, Int CMD [, Int * Argdx, Int Argcx]) This function is used to control input / output devices, please see the table below:

┌ - ┬──────────────────── ─ │CMD value │ function │ ├──────── ──────────────── ┤ │ 0 │ Remove Equipment Information │ │ 1 │ Settings Equipment Information │ │ 2 │ Put the argcx byte by Argdx Address │ │ 3 │ The address referred to argdx Write argcx bytes │ │ 4 │ In addition to the handle as a device number (0 = current, 1 = a, etc.), both CMD = 2 │ │ │ 5 │ In addition to handle as a device number (0 = current, 1 = A, etc.), alliances with cmd = 3 │ │ 6 │ Take Input Status │ │ 7 │ Take Output Status │ │ 8 │ Test Rechangeability; only for DOS 3.x │ │ 11 │ set conflict of sharing conflicts; only DOS 3.x │ └ - ─ ──────────── ──────────── ┘int (* Ssignal (int SiG, int (* action) ()) () executes software signals (unnecessary) int Gsignal (int SIG) executes software signals (no Useful

INT _OPEN (CHAR * PATHNAME, INT Access) to open a file for reading or writing, press Access to determine whether reading file or write files, Access values ​​see the table below - ────────── ────────── ─ ┐ │ACCESS value │ │ ├──────────────────────────── │O_RDONLY │ Read File │ │O_WRONLY │ │ │O_RDWR │ │ │ │O_NOINHERIT │ If the file is not passed to the subroutine, it is included │ │O_Denyall │ only allows the current handleable file │ │O_Denywrite │ Allows from any other open file read │ │O_DENYREAD │ Allows from any other open file │ │O_DENYNONE │ allows other shared files │ └─────────────────────── ───────────── ─ ┘int open (char * pathname, int access [, int permiss]) For read or write open a file, press Access to confirm is a read file or write files, Access See the table below - ─ ────────────── ─ ─ │ACCESS │ Significance │ ├───────── ───────── ─ ┤ │O_RDONLY│T reading file │ │O_WRONLY│Wick file │ │O_RDWR │ │ │O_NDELAY│No; Neix System Compatibility │ │O_APpend│ 即 读 也 写, but each time you write always add │ │O_CREAT │ If the file exists, this flag is useless; If there is no existence, build a new file │ │O_TRUNC │ If the file exists, the length is intercepted 0, the attribute constant │ │O_EXCL │ │O_binary │ │ __binary│ This flag can be displayed in binary way File │ │O_TEXT │ This flag can be used to show a text mode to open files │ └─────────────────────────── ┘ Permiss as file attribute You can use the following values: S_IWRITE allows writing S_IREAD to allow reading S_IREAD | S_IWRITE to allow read, write int Creat (CHAR * FileName, INT Permiss) to create a new file filename, and set read and write. Permiss is read or written for file, allowing the following value S_IWRITE to write S_IREAD to allow reading, INIREAD | S_IWRITE to allow reading, write int _CREAT (CHAR * FileName, int Attrib) to establish a new file filename, and set file properties.

Attrib for file properties, you can hide the following value FA_RDONLY read-only FA_HIDDEN hide the FA_SYSTEM system INT CreatNew (Char * filenamt, int attrib) to create a new file filename, and set file properties. Attrib for file properties, you can hide the following value FA_RDONLY read-only FA_HIDDEN hide the FA_SYSTEM system INT CreatTemp (Char * filenamt, int attrib) to create a new file filename, and set file properties.

Attrib for file properties, you can hide the following value FA_RDONLY read-only FA_HIDDEN hide the FA_SYSTEM system int ie, the NBYTE "from the file number is written in the file number, the NBYTE" is stored in BUF INT _READ (INT HANDLE) , void * buf, int nbyte) Read NBYTE characters from the file number to Handle to store into buf, call MSDOS to operate .int Write (int Handle, Void * BUF, INT NBYTE) Put the NBYTE in BUF The character writes the file number in the file number in the file number INT _WRITE (INT HANDLE, VOID * BUF, INT NBYTE) Write the NBYTE character in the BUF to the file number for the Int Dup (Int Handle) Copy a file processing pointer Handle, returning this pointer int DUP2 (INT HANDLE, INT NewHandle) Copy a file processing pointer Handle to NewHandleint EOF (int * handle) Check if the file ends, end returns 1, otherwise returns 0long fileLength Returns the file length, Handle For the file number int setmode (int Handle, unsigned mode) This function is used to set the file number to open the file number INT getftime (int Handle, Struct FTIME * ftime) Read the file number of the file number. In the FTIME structure, the file time is saved, and the FTIME structure is as follows: ┌ --───────────── ─ │STRUCT FTIME │ │ {│ │ UNSIGNED FT_TSEC: 5; / * Second * / │ │ unsigned ft_min: 6; / * 分 * / │ │ unsigned ft_Hour: 5 ; / * * / │ │ unsigned ft_day: 5; / * day * / │ │ Unsigned ft_month: 4; / * month * / │ │ unsigned ft_year: 1; / * year -1980 * / │ │ │ └─ ───────────────── ─ ┘int setftime (int Handle, Struct ftime * ftime) Reword file number is the file time of Handle, the new time is in the structure ftime. Successful returns 0. Structure The ftime is as follows: ┌ --─────────── │ │STRUCT FTIME │ │ {│ │ UNSIGNED FT_TSEC: 5; / * Second * / │ │ Unsigned ft_min: 6; / * * / │ │ UNSIGNED FT_HOUR: 5; / * * / │ │ Unsigned ft_day: 5; / * day * / │ │ unsigned ft_month: 4; / * month * / │ │ unsigned ft_year: 1;

/ * Year -1980 * / │ │} │ └ - ──────────────────────────────────────────────────────────────gyongişmlikin The file's pointer is moved to the origin of the release. Seek_set file Switch seek_cur Current location SEEK_END File Tail Long Tell (INT HANDLE) This function returns the file number to the handle file pointer, indicating ISATTY in byte (Int Handle) This function is used to take the type of INT LOCK (INT HANDLE, Long Offset, Long LENGTH) to the file shared Int Unlock (INT HANDLE, Long Offset, Long Length) Opens the block shared Int Close (Int Handle) Close the file processing represented by Handle, handle is from _CREAT, CREAT, CREATNEW, CREATTEMP, DUP, DUP2, _OPEN, and one of the files obtained from one of _creat, dup2, _open, and Open. _close (int Handle) Close the file processing represented by Handle, handle is from _CREAT, CREAT, CREATNEW, CREATTEMP, DUP, DUP2, _OPEN, and one of the files obtained in one of the time in Open, otherwise returning -1, only Can be used for MSDOS system file * fopen (char * filename, char * type) open a file filename, open mode is type, and return this file pointer, Type can add a suffix to the following string - ┬──── ┬───────────── ─ ┐ │TYPE│Express │ Text / 2 credit │ Building / Open Old File │ ├───────────────────────────────────────────────────────── ────────────── ┤ │R │ │ Text │ Open Old File │ │W │ 写 │ │ │ │ │ │ 文 文 │ │R │ Read / write │ │ │ │ │ │ │ │ │ │ Build new file │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │A │ Read / Add │ No limit │ Open Improvement to Built │ └ - ┴───────────────────────── ┘ 加 的 suffix is ​​T, B.

Plus B indicates that the document is operated in binary form, T is not necessarily used: ┌ --──────────────── │ │ │MAIN () │ │ {│ │ File * fp; │ │ │FP = FOPS.exe, "R B"); │ └────────────── ───── ─ ┘file * fdopen (int Ahndle, Char * Type) File * Freopen (Char * FileName, Char * Type, File * Stream) INT GETC (File * Stream) Reads a character from the stream stream and returns this Character INT PUTC (INT CH, File * Stream) Writes a character chint getw (file * stream) from the stream stream into an integer, error Returns EOFINT PUTW (INT W, File * Stream) Writing to stream Stream An integer int ungetc (char C, file * stream) returns the character C back to the stream stream, the next read character will be Cint Fgetc (File * Stream) to read a character from the stream stream,

And return this character int FPUTC (int CH, File * Stream) to read the character ch write into the stream stream CHAR * FGETS (CHAR * STRING, INT N, FILE * STREAM) N characters from the stream Stream into the string Int FPUTS (Char * String, File * Stream) Write strings String Write the stream Stream INT FREAD (Void * Ptr, Int size, int Nitems, file * stream) reads NITEMS lengths from the stream stream from the stream SIZE Store int FWRITE (Void * PTR, int size, int nitems, file * stream) to write NITEMS lengths of Size, string in PTR in PTR, in PTR, Format [, argument, ...]) Reads a string int vfscanf (File * Stream, Char * Format, Valist Param) in formatted form to format a string, parameter from the stream stream in formatting. Get int FPRINTF (File * Stream, Char * Format [, Argument, ...] from Valist Param to format a string to the specified stream Streamint Vfprintf (File * Stream, Char * Format, Valist Param) The format forms writes a string to the specified stream stream. The parameters take the int FSeek (File * Stream, long offset, int.comwhere) function from the Valist Param to move the file pointer to the back Offset byte by the location of FROMWHERE. At the point of the following values: seek_set file switch seek_cur Current location seek_end file tail long ftell (file * stream) function Returns the current file pointer position in Stream, indicating int Rewind (File * Strea M) Map the current file pointer Stream to the file start INT feof (file * stream) detection streaming file pointer on the end position int fileno (file * stream) to process the file processing on the stream, and return to the file processing INT Ferror (File * stream) Check if there is a read and write error on Stream,

If there is an error, return 1void Clearerr (File * Stream) Clear stream Stream read-write error Void SetBuf (File * Stream, Char * BUF) Give Stream Specify a buffer bufvoid setvbuf (file * stream, char * buf, int Type, unsigned size) Give Stream Specifies a buffer BUF, size is size, type Type, Type's value see you - ┬──────────────────────── ────────── ─ ┐ │TYPE │ │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ────── ─ ┤ │_IOFBF│Fable is a complete buffer, when the buffer is empty, the next input operation will attempt to fill the entire loose │ │ │ 区. When output, write any data to Before the file, the buffer will be completely filled. │ │_iolbf│ file is a row buffer. When the buffer is empty, the next input operation will still try to fill the entire loose │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ Write the file, the buffer is cleaned. │ │_ │BF│ file is unbuffered .buf and size parameters are ignored. Each input operation will directly pass the text │ │ │-read, each output operation will immediately write the data file. │ └───┴───────────────────────────────┘int fclose ( File * stream off a stream that can be a file or device (for example, LPT1) int Fcloseall () Close all stream INT FFLUSH (File * Stream) except STDIN or STDOUT to turn off a stream, and processed the buffer processing. Read the stream, read the contents of the stream into the buffer; write the flow of the buffer to write the contents within the buffer. Successfully returned 0INT FFLUSHALL () to close all streams, and the respective buffer is processed by the target, the flow of the stream, read the contents within the buffer; the write stream, write the contents within the buffer. Successfully returned 0INT Access (CHAR * Filename, Int Amode) This function checks file filename and returns the properties of the file, the function exists in Amode, and the combination of Amode is written by the combination of the following bit. You can read 02 can be written 01 Perform (ignored) 00 files There is if FileName is a directory, the function will only determine if the directory exists to perform successful returns 0, otherwise returns -1int chmod (int permiss) This function is used to set the file filename properties Permiss can allow S_IREAD to allow reading S_IREAD to allow reading S_IREAD | S_IWRITE to allow read, write int _chmod (char * filename, int func [, int attrib]); this function is used to read or set the properties of file filename, when func When = 0, the function returns the properties of the file; when func = 1, the attribute of the function setting file is set to one of the following constants, FA_RDOONLY read-only FA_HIDDEN hide the FA_SYSTEM system.

转载请注明原文地址:https://www.9cbs.com/read-85393.html

New Post(0)