TC2.0 function description

zhaozj2021-02-17  49

The classification function, the function library is CTYPE.H INT ISALPHA (INT CH) if CH is the letter ('A' - 'Z', 'A' - 'Z') Returns a non-0 value, otherwise returns 0 ISALNUM (INTC If CH is the letter ('A' - 'Z', 'A' - 'Z') or numbers ('0' - '9'), return non-0 value, otherwise returns 0 int ISASCII (INT CH) if Ch Is a character (0-127 in the ASCII code) Returns a non-0 value, otherwise it returns 0 int ISCNTRL (INT CH) If the CH is a waste character (0x7f) or normal control character (0x00-0x1f), return non-0 value, otherwise returns 0 INT isdigit (int CH) If the CH is a number ('0' - '9') returns a non-0 value, otherwise returns 0 int ipegraph (int CH) if CH is a printable character (excluding space) (0x21-0x7e) Returns a non-0 value, otherwise it returns 0 ISLOWER (INT CH) if the ch is lowercase letters ('A' - 'Z') returns a non-0 value, otherwise returns 0 int isprint (int CH) if CH is printable characters (including Space) (0x20-0x7e) Returns a non-0 value, otherwise returns 0 int IPUNCT (INT CH) Returns a non-0 value if the CH is the punctuation character (0x00-0x1f), otherwise returns 0 int ISSPACE (INT CH) if ch is a space ( ''), Horizontal tabs ('/ t'), Enter ('/ R'), Paper Wavel ('/ f'), Vertical Table ('/ V'), Repair (' / n '), return a non-0 value, otherwise returning 0 int isupper (int CH) If the CH is uppercase letters (' a '-' z ') returns a non-0 value, otherwise returning 0 int isxdigit (int CH) if ch is 16 Enter ('0' - '9', 'A' - 'F', 'A' - 'F') Returns Non 0 Values, otherwise returns 0 int TOLOWER (INT CH) if ch is uppercase letter (' A '-' Z ') Returns the corresponding lowercase letters (' A '-' Z ') Int Toupper (INT CH) If CH is lowercase letters (' A '-' Z ') returns the corresponding uppercase letter (' A ' -'Z ') Mathematical functions, the function library is Math.h, stdlib.h, string.h, float.h int ABS (INT i) Returns the absolute value of the entire parameter i Double Cabs (Struct Complex Znum) Znum's absolute value Double Fabs (double x) Returns the double precision parameter x The absolute value long Labs (long n) Returns the absolute value Double EXP (Double X) returns the value of the index function EX Double frexp (Double Value, INT * EPTR) Returns the value of X * 2n in value, n Store Double Ldexp (Double Value, Int Exp) in EPTR;

Returns Value * 2EXP Value Double Log (Double X) Returns Double Log10 (Double X) Returns Double Pow (Double X, Double Y) Returns Double Pow10 (INT P) Returns 10p Double Double Double Double Double Double Double SQRT (double X) Returns the X-Double Double ACOS (Double X) Returns the X-flavored COS-1 (X) value, X is an angiobial sin-1 (x) value returns X of the radio Double Asin (Double X) , X is an arc Double Atan returns an anti-orthodox Tan-1 (X) value, X is the arc Double ATAN2 (Double Y, Double X) Returns Y / X of an anti-orthodox Tan-1 (X) value, Y X X is the cosine COS (X) value returns the X of the x, X is the sinusoidal SiN (X) value returns the X (Double X), and X is the arc Double Tan (Double X) returns The orthosis TAN (X) value of X, X is the two-curmed Cosh (X) value returns the X of the radians Double Cosh (X) value, and X is a dual sine SINH (X) value returns X of the arc Double SINH (Double X). , x is the two-dicing Tanh (X) value returns the X of X, X is the arc Double Hypot (double x, double y) Returns the length (Z), X and Y as the right angle triangle. Side length, z2 = x2

Y2 Double CEIL (Double X) Returns the minimum integer floor (double x) of the NOD (Double X) Returns the maximum integer void Srand (unsigned seed) initialization random number generator INT RAND () generates a random number and returns this number Double Poly (Double X, INT N, Double C []) generates a multi-term Double MODF (Double Value, Double * IPTR) from the parameter to decompose the double-precision value value to the mantissa and Double Fmod (double x, double y) Return to X The remainder of / y Double Frexp (Double Value, INT * EPTR) divides the double-precision value VALUE into the mantissa and the order Double ATOF (Char * NPTR) converts the string NPTR into floating point number and returns this floating point number Double Atoi (char * nptr) Converting the string NPTR into an integer and returns this integer Double Atol (Char * NPTR) to convert the string NPTR to the integer and return this integer char * ECVT (Double Value, int NDIGIT, INT * DECPT, INT * SIGN) to float Value converts the string and returns the 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) converts the number value into a string and returned to the buf pointer char * ULTOA (unsigned long value, char * string, int RADIX) converts unsigned integer values ​​into a string and returns This string, RADIX is converted to the conversion CHAR * LTOA (Long Value, CHAR * STRING, INT RADIX) converts long-intensive value VALUE into a string and returns the string, and Radix is ​​based on the base char * ITOA ( INT Value, Char * String, Int Radix converts the integer value into a string to store String, Radix is ​​the base Double Atof (Char * nptr) using the base Double ATOF (Char * nptr) when converting PTR conversion into a double-precision number, return this number, error Returns 0 int atoi (char * nptr) Converting the string nptr into an integer number, return this number, error Returns 0 long atol (char * nptr) will string NPTR conversion to the total number, and return this number, the error returns 0 Double StRTOD (Char * Str, Char ** Endptr) converts the string STR into double precision, returns this number, Long Strtol (Char * Str, Char ** endptr, int base converts the string STR conversion to the total number, returns this number, int match (Struct Exception * e) user modifies mathematical error return information function (no need to use) Double _Matherr (_Mexcep why, char * Fun, Double * Arg1p, Double * Arg2P, Double Retval) User Modify Mathematical Error Return Information Functions (Nothing Use) Unsigned INT_CLEAR87 () Clears floating point status words and returns the original floating point status void _fpreset () Reproduction Floating point mathematics package unsigned int _status87 () Returns the floating point status word directory function, the function library is dir.h, dos.h int chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd chd cry ") Turns into the current working directory, successfully returns 0 int FindFirst (CHAR * PATHNAME, STRUCT FFB ​​* FFBLK, INT Attrib) Find the specified file, successfully returns 0 PathName as the specified directory name and file name, such as" C: // WPS // txt "

Ffblk is a structure for the specified save file information, defined as follows: ┏┏━━━━━━━━━━━━━━━━┓┓┓┓┓━━━━━━┓┓ ┓ ┓Truct Ffblk ┓ ━ ━ ┓ ┓ ┓ ━ ━ DOS reserved word * / char ff_attrib; / * file attribute * / INT ff_ftime; / * file time * / ternal file date * / LONG FF_FSIZE; / * file length * / Char ff_name [13]; / * file name * /}} ┗┗━━━━━┛━━━━━━━━━┛┛┛┛┛ 为 为━━━━━┛┛ Attrib for file properties, by the following character representative ┏┏━━ ━━━━━┳┳━━━━━━┓┓ ┓f_rdonly read-only file FA_Label volume marking number h h hidden file Fa_direc catalog _system system file ┗__━━━━━━━ ━┻┻━━━━━━━ ┛┛: struct ffblf; findfirst ("*. Wps", & ff, fa_rdonly); int FindNext (struct ffblk * ffblk) Repeat the Findway file, successfully return 0 void fumege (char * path, char * drive, char * dir, char * name, char * ext) This function passes the drive DRIVE (C:, A:, etc.), path DIR (/ TC, / BC / LIB, etc.), files Name (TC, WPS, etc.), extension ext (.exe, .com, etc.) form a file store in Path. Int fnsplit (Char * path, char * drive, char * dir, char * name, char * EXT) This function breaks down the file name Path into a disk letter Drive (C:, A:, etc.), path DIR (/ TC, / BC / LIB, etc.), file name Name (TC, WPS, etc.), extension EXT (. EXE, .COM, etc.) and deposit into the corresponding variables. INT getCurdir (int DRIVE, CHAR * DIREC) This function returns the current work directory name of the specified drive. Successfully returned 0 Drive Specified drive (0 = Current, 1 = A, 2 = B, 3 = C, etc.) DIREC Save Variables of the Specifies Drive Current Work Path Char * getCwd (Char * BUF, IINT N) This function takes the current work The directory is stored in BUF until the N-byte length is long. Error Returns NULL INT GETDISK () Take a drive that is currently in use, returns an integer (0 = a, 1 = B, 2 = C, etc.) int SetDisk INT Drive) The drive drive to use (0 = a, 1 = b, 2 = c, etc.), returns to build a new directory Pathname using the total number of drives, and successfully returns 0 int RMDir (charr * Pathname Delete a directory PathName, successfully returned 0 Char * mktemp (char * template) Constructing a file name not in a current directory and stores a file file file file file file file file file file file file file in TemPlate, this The function uses the DOS's path variable, and does not find the file to return the NULL process function. The function library is stdlib.h, and the process.h void abort () This function writes a termination information in stderr by calling _exit with export code 3, and abnormally Terminate 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 For the subroutine, the error returns -1. In the Exec function family, the suffix L, V, P, E are added to EXEC, and the specified function will have some operational capabilities. When there is suffix P, the function can use the DOS's PATH variable to find the subroutine 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 ... running 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 * 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 The function family runs the subroutine Pathname in the MODE mode and passes the parameter arg0 (arg1, arg2, argv [], envp []) to the subroutine. Error returns -1 Mode to run mode: Mode indicates the subroutine operation Follow the release of this program P_NOWAIT to run this program (unavailable) p_overlay in the subroutine runtime indicates that the operator is added to the spawn function family after this program exits, the suffix L, V, p, and e added to the spawn,

When the specified function will have some operace with a suffix P, the function uses DOS's PATH to find the subroutine file L. The number of parameters passed by the function is fixed. V, the number of parameters passed is not fixed. E, Specifying parameter ENVP can be passed to a subroutine, allowing to change the subroutine running environment. When the suffix E, the subroutine uses the environment of this program. Int System (char * Command) passes the MSDOS command Command to the DOS execution of the converter subroutine, the library For Math.h, Stdlib.h, CType.h, Float.h Char * ECVT (Double Value, Int Nd Ndigit, INT * DECPT, INT * SIGN) converts floating point value value into a string and returns to this 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) converts the number Value into a string coexistence In BUF, return 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 ​​based on the base CHAR * LTOA. (Long Value, Char * String, Int Radix converts long-interented VALUE into a string and returns the string, Radix is ​​the base char * ITOA (int value, char * string, int rading) when converting Converting a string to store String, radix is ​​converted to the base Double ATOF (Char * nptr) to convert the string nptr into the number of double precision, return this number, error returns 0 int atoi (char * nptr) will string NPTR Convert to an integer, return this number, error Returns 0 long atol (char * nptr) converts the string NPTR to a long integer number, return this number, error Return 0 Double Strtod (char * str, char ** Endptr ) Converting the string STR to double precision, returns this number, Long Strtol (CHAR * STR, CHAR ** ENDPTR, INT BASE) converts the string STR to growth, And return this number, int toascii (int C) Returns the corresponding ASCII INT TOLOWER (INT CH) If CH is uppercase letters ('A' - 'Z') Returns the corresponding lowercase letters ('A'-' Z ') INT _TOLOWER (INT CH) Returns the corresponding uppercase letters ('A') if CH is lowercase letters ('A' - 'Z') ('A') - 'Z') INT _TOUPPER (INT CH) Returns the CHOW Cards ('A' - 'Z') diagnostic function, the function library is Assert.h, Math.h void assert (int Test) an extension into IF Macro like the statement, if the Test test fails, displays an information and abnormally stopped the program, the non-return VOID PERROR (CHAR * STRING) This function will display the most recent error message, the formats such as:

String string: Error message Char * strerror (char * STR) This function returns the last error message, format, string str: error message int match (STRUCT EXCEPTION * E) User Modify Mathematical Error Return Information Function (no necessary Use Double_Matherr (_MexceP Why, Char * Fun, Double * Arg1p, Double * Arg2p, Double Retval) User Modify Mathematical Error Return Information Function (Nothing Use) Input Output Subprint, Function Library is IO.H, Conio.h , Stat.h, dos.h, stdio.h, Signal.h int kbhit () This function returns a recently knocked button int FGETCHAR () reads a character from the console (keyboard), displayed on the screen INT getch () Read a character from the console (keyboard), not displayed on the screen INT pUTCH () Write a character int GETCHAR () from the console (keyboard), display on the screen Int Putchar () Write a character INT getChe () from the console (keyboard) to read a character from the console (keyboard), displayed on the screen INT UNGETCH (INT C) to return the character C back to the console (keyboard) char * cgets (char * string ) From the console (keyboard) to read the string in string int Scanf (Char * Format [, argument ...]) reads a string from the console, assigns each parameter, and uses the BIOS to output int vscanf. CHAR * FORMAT, VALIST PARAM) Reads a string from the console, assigns each parameter, using the BIOS to output, the parameters take int Cscanf (Char * format [, argument ...] from the Valist Param from the console Enter a string, assign each parameter, directly on the control table, such as the display when the display is displayed in the display INT SSCANF (Char * string, char * format [, argument, ...]) By string String, assigning all parameters int vsscanf (char * string, char * format, vlist param), assigns each parameter, refers to each parameter. Number String String to the Console (Display) from VLIST Param, using BIOS to output Void CPUTS (Char * String) Send a string string to console (display), direct For the control table operation, such as the display of the display, INT Printf (Char * FORMAT [, ARGUMENT, ...]), the display is sent to the console (display), using the BIOS to output int vprintf (char * Format, Valist Param Send a format string output to the console (display),

Use the BIOS to output, the parameters take int CPRINTF (Char * Format [, Argument, ...]) to send formatted strings from the Valist Param to the console (display), directly on the control table, such as the display is directly written Frequency mode Display INT VCPRINTF (Char * Format, Valist Param) Send Format String Output to Console (Display), directly on the control table, such as the display is displayed directly, the parameters are obtained from the Valist Param Sprintf (char * string, char * format [, argument, ...]) Reconnects the contents of the string string to formatted string int vsprintf (char * string, char * format, valist param) will string String The content is rewritten as a formatted string, and the parameter gets int Rename (Char * OldName, Char * newname) from Valist Param to change the name of the file OldName to NewName IOCTL (Int Handle, Int CMD [, INT * Argdx, INT Argcx]) This function is used to control input / output devices, please see the following table: ┌ - ─ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─ ─ │CMD value │ function │ ├─┼───────────────────────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ Information │ │ 1 │ Settings Equipment Information │ │ 2 │ Read ArgCx byte into the address referred to by Argdx │ │ 3 │ ∎ Added ARGCX byte │ │ 4 │ In addition to handle Handle as a device number ( 0 = Current, 1 = a, etc.), both CMD = 2 │ │ 5 │ In addition to handle Handle as a device number (0 = current, 1 = a, etc.), all and cmd = 3 When │ │ │ Take Input Status │ │ 7 │ Take Output Status │ │ 8 │ Test Conformability; For DOS 3.x │ │ 11 │ Set Sharing Conflict;

Only for DOS 3.x │ └ - ─ ─────────────────────────────────────────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ()) ()) ()) () executes software signals (unnecessary) INT GSIGNAL (INT SIG) executes software signals (unnecessary) int _open (char * pathname, int access) to open a file for reading or writing, press After the Access is confined to read the file or write the file, the Access value is seen in the table. - ────────────────────── ─ ─ ─ ─ ─ │ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ Significance │ ├──────────────────── ─ │O_RDONLY │ Read File │ │O_WRONLY │written file │ │O_RDWR │ 即 读 也 写│ │O_noinherit │ If the file is not passed to the subroutine, it is included │ │O_Denyall │ only allows the currently handle necessary to access file │ │O_Denywrite │ only allowed to open files from any other open │ │O_DenyRead │ only allows from any other Opened file write │ │O_Denynone │ Allow other shared files │ └ - ──────────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ , int access [, int permiss]) To read or write a file, press Access to determine whether it is reading the file or writes the file, and the Access value is seen in the table --- - ┬─────── ───────── ─ ┐ │ACCESS value │ Significance │ ├───────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │O_WRONLY│Written Document │ │O_RDWR │ │ │ │O_NDELA │ Nothing; INSTRC C│ │O_APpend│ 即 读 也, but each time write is always added to the file tail Add │ │O_CREAT │ │ Existence, this flag is useless; if there is no existence, the new file │ │O_TRUNC │ If the file exists, the length is intercepted 0, the attribute constant │ │O_EXCL │ │ │O_binary │ │O_Binary│ This flag can be displayed This flag can be used to display text mode to open files in a binary method to open files in text. └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─ ┘ Permiss for file properties, can be the following values: s_iwrite Optics S_IREAD allows read S_IREAD | S_IWRITE to allow reading, 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 the file number to store the NBYTE, directly 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 in the file number, 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 NewHandle Int EOF (INT * HANDLE) Check if the file ends, end returns 1, otherwise returns 0 long fileLength Returns the file length Handle is the time for the file number for the file number Int setmode (int Handle, Unsigned Mode) to set the file number to open the file number INT getftime (int Handle, Struct ftime * ftime) Read the file number for the file number And save the file time in the FTIME structure, successfully returned 0, 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; / * Years -1980 * / │ │} │ └──────────────── ─ ┘ Int setftime (int Handle, Struct FT IME * ftime) Reword file number is the file time of Handle, the new time is in the structure ftime. Successful returns 0. Structure ftime as follows: ┌────────────── ─ │STRUCT FTIME │ │ {│ │ unsigned ft_tsec: 5; / * │ │ 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 │ │ │ │ │W │ 写 │ │ │ 建 文件 文件 │ │ │ │ │ Text │ If you have an open? │R │ Read / Write │ Unlimited │ Open │ │W │ Read / Write │ Unlimited │ Construction Document │ │A │ Read / Add │ Unlimited │ Open Improper Construction │ └─────────────────────────────────────────────────tes ┴────────────────── ─ ┘ can be added to T, B. Plus B indicates that the document is operated in binary form, and T is not necessarily used: ┌ --─────────────── ─ │ # include│

│main () │

│ {│

│ File * fp; │

│ fp = fopen ("c: //wps//WPS.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 CH to stream Stream

INT GETW (File * Stream) reads an integer from the stream stream, error returns EOF

INT PUTW (INT W, File * Stream) Writes an integer to stream Stream

INT UNGETC (Char C, File * Stream) Returns the character C back to the stream stream, the next reading character will be C

INT FGETC (FILE * stream) reads a character from the stream stream and returns this character.

INT FPUTC (INT CH, File * Stream) Write Character CH into Stream Stream

Char * Fgets (Char * String, Int N, File * Stream)

Read N characters from streaming Stream to String

INT FPUTS (Char * String, File * Stream) Write strings String into Stream INTFREAD (Void * Ptr, Int Size, Int Nitems, File * Stream)

Read the NITEMS in the stream stream to store the string of the size of the size in the PTR

Int Fwrite (void * ptr, int size, int nitems, file * stream)

Write a string of NITEMs in the stream Stream to the Size, the string in the PTR

Int fscanf (file * stream, char * format [, argument, ...])

Read a string from the stream stream in a formatted form

Int Vfscanf (File * Stream, Char * Format, Valist Param)

Read a string from the stream stream in a formatted form, the parameters have obtained from the Valist Param

Int fprintf (file * stream, char * format [, argument, ...])

Write a string to the specified stream stream with formatted form

Int Vfprintf (File * Stream, Char * Format, Valist Param)

Write a string to the specified stream stream in formatted form, and the parameters have obtained from Valist Param.

Int fseek (file * stream, long offset, int fromwhere)

The function moves the file pointer to the backstart byte of the location of FROMWHER, and the fromwhere can be the following value:

Seek_set file switch seek_cur Current location SEEK_END file end

LONG FTELL (FTELL (File * Stream) function returns the current file pointer position positioned in the stream, in byte

INT REWIND (File * Stream) Moves the current file pointer stream to the beginning of the file

INT feof (file * stream) Detects the file pointer on the stream Stream at the end position

INT fileno (file * stream) Recent file processing on Stream and returns file processing

INT FERROR (File * Stream) Checks if there is a read and write error on Stream, if there is an error, return 1

Void Clearerr (File * Stream) Clearing the read and write error on the stream stream

Void SetBuf (File * Stream, Char * BUF) Give Stream Specify a buffer BUF

Void setvbuf (File * Street, Char * BUF, INT TYPE, UNSIGNED SIZE)

Give Stream Stream Specifies a buffer BUF, size size, type Type, Type's value see the table below

┌ - ┬─────────────────────────

│TYPE Value │ Significance │

├─────────────────────────────────

│_IOFBF│Fable is a full buffer, when the buffer is empty, the next input operation will attempt to fill the entire loose │

│ │ 区. When you write any data, you will completely fill the buffer. │

│_IOLBF│Fable is a row buffer. When the buffer is empty, the next input operation will still try to fill the entire │

│ │ 区. However, when the output is written, the buffer is cleaned whenever the new line is written. │ │

│_ ionbf│Fable is unbuffered. BUF and SIZE parameters are ignored. Each input operation will directly │

│ │ Pack, each output will immediately write data to the file. │

└ - ┴─────────────────────────

INT Fclose (file * stream) Close a stream, can be a file or device (for example, LPT1)

INT fcloseall () Close all streams except STDIN or STDOUT

Int fflush (file * stream)

Turn off a stream and processes the buffer processing, that is, the stream is read, and read the contents within the buffer; write the stream of the buffer, write the contents in the buffer. Successfully returned 0int fflushall ()

Turn off all streams, and converge the respective buffer works to process the read stream, read the contents of the buffer within the buffer; write the contents within the buffer. Success return 0

Int Access (Char * filename, int Amode)

This function checks the file filename and returns the properties of the file, the function is stored in Amode, and the Amode is composed of the combination of the following bit.

06 can read, write 04 can read 02 can write 01 execution (ignored) 00 file existence

If FileName is a directory, the function will only determine if the directory exists to perform successful returns 0, otherwise returns -1

INT chmod (char * filename, int permiss) This function is used to set the properties of the file filename

Permiss can be the following value

S_IWRITE allows writing S_IREAD to allow reading s_iread | s_iwrite to read, write

INT _CHMOD (Char * filename, int func [, int attrib]);

This function is used to read or set the properties of the file filename,

When FUNC = 0, the function returns the properties of the file; when func = 1, the function sets the properties of the file.

If the file attribute is set, Attrib can be one of the following constants.

FA_RDONLY read-only FA_HIDDEN hides the FA_SYSTEM system

Interface subroutine, the function library is: dos.h, bios.h

Unsigned Sleep (unsigned seconds) Pause Seconds microseconds (one percent)

INT unlink (char * filename) Remove file filename

Unsigned fp_off (Void Far * Farptr) This function is used to take the offset of far pointer Farptr

Unsigned fp_seg (Void Far * Farptr) This function is used to set the value of the far pointer Farptr

Void Far * mk_fp (unsigned seg, unsigned off) constructs a FAR pointer according to segment SEG and offset OFF

UNSIGNED getPSP () decreasing segment address segment address, and return this address

Char * PARSFNM (Char * Cmdline, Struct FCB * Fcbptr, Int Option)

The function analyzes a string, usually, for a file name, is a command line referred to by cmdline.

The file name is put in an FCB as a drive, file name, and extension. Fcb is specified by FCBPTR.

The Option parameter is the value of the Al text when the DOS analysis system is called.

Int Absread (int DRIVE, INT Nsects, int SECTNO, VOID * BUFFER)

This function function is to read a specific disk sector.

Drive is driven number (0 = a, 1 = B, etc.), Nsects is the number of sectors to read, and SECTNO starts logical sector number, buffer is saving the read data. Save space.

Int Abswrite (int DRIVE, INT Nsects, int SECTNO, VOID * BUFFER)

This function function is written in a specific disk sector.

Drive is the drive number (0 = a, 1 = b, etc.), NSECTS is the number of sectors to be written, and the sectno starts logical sector number, buffer is the space where the data is saved.

Void getDFree (int Drive, Struct Dfree * DFreeP)

This function is used to take the free space of the disk.

Drive is a disk number (0 = Current, 1 = A, etc.). Functions In the DFREE structure of the disk characteristic, the DFree structure is as follows:

┌────────────────────────────

│STRUCT DFREE │

│ {│

│ Unsigned DF_AVAIL; / * Useful cluster number * / │

│ unsigned DF_TOTAL; / * Total cluster number * / ││ unsigned df_bsec; / * Each sector bytes * / │

│ Unsigned DF_SClus; / * Number of each cluster sector * / │

│} │

└────────────────────────────

Char Far * getdta () Take the disk switch address DTA

Void SetDTA (Char Far * DTA) Set Disk Conversion Address DTA

Void getfat (int drive, Fatinfo * Fatblkp)

This function returns the file allocation table information of the specified drive Drive (0 = current, 1 = A, 2 = B, etc.) and stored in the structural FATBLKP, the structure is as follows:

┌─────────────────────

│STRUCT Fatinfo │

│ {│

│ Char Fi_SClus; / * Each cluster sector number * / │

│ char fi_fatid; / * File allocation table byte number * / │

│ INT FI_NCLUS; / * Number of clusters * / │

│ INT FI_BYSEC; / * Number of bytes per sector * / │

│} │

└─────────────────────

Void getFATD (STRUCT FATINFO * FATBLKP) This function returns the file allocation table information of the current drive, and stores in FATBLKP, the structure is as follows:

┌─────────────────────

│STRUCT Fatinfo │

│ {│

│ Char Fi_SClus; / * Each cluster sector number * / │

│ char fi_fatid; / * File allocation table byte number * / │

│ INT FI_NCLUS; / * Number of clusters * / │

│ INT FI_BYSEC; / * Number of bytes per sector * / │

│} │

└─────────────────────

INT BDOS (int dosfun, unsigned dosdx, unsigned dosal)

This function calls the MSDOS system, dosdx is the value of the register DX, DOSAL is the value of the register Al, DOSFUN is function number.

Int Bdosptr (int dosfun, void * argument, unsiigned dosal)

This function is called for the MSDOS system.

Argument is the value of the register DX, DOSAL is the value of the register Al, DOSFUN is function number.

INT INT86 (int INTR_NUM, Union Regs * INREGS, Union Regs * Outregs)

Execute the INTR_NUM number interrupt, the user-defined register value exists in archregs, and the returned register value is stored in Outregs after execution.

INT INT86X (int INTR_NUM, Union Regs * INREGS, UNION Regs * Outregs, Struct Sregs * Segregs)

Executing an Intr_num number interrupt, the user-defined register value is stored in the structure inregs and the structure SegRegs, and the returned register value is stored in the structure Outregs after execution.

int INTDOS (Union Regs * Outregs)

This function executes the DOS interrupt 0x21 to call a specified DOS function, and the user-defined register value exists in the structure inregs, and the function will save the returned register value in Outregs.

Int INTDOSX (Union Regs * Outregs, Struct Sregs * SegRegs)

This function executes the DOS interrupt 0x21 to call a specified DOS function, the user-defined register value exists in INREGS and SegRegs, and the function will be stored in the structure Outregs.

Void INTR (int INTR_NUM, STRUCT Regpack * PREG)

An alternate 8086 software interrupt interface in this function produces an 8086 software interrupt specified by the parameter INTR_NUM.

The function replicates the user-defined register value to each register from the structure preg before executing the software interrupt. After the software is broken,

The function is copied to the value of the current registers into the structure preg. The parameters are as follows: INTR_NUM executed interrupt number, preg is the structure of saving the user-defined register value, the structure is as follows

┌───────────────────

│STRUCT Regpack │

│ {│

│ unsigned r_ax, r_bx, r_cx, r_dx; │

│ Unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags; │

│} │

└───────────────────

After the function is executed, the new register value is stored in the structural preg.

Void Keep (int Status, int size)

Returns MSDOS in the Status state, but the program remains in memory, and the occupied space is determined by size.

Void CtrlBrk (int (* fptr) ()) Sets the interrupt handler after the interrupt.

Void disable () disabled interrupt

void enable () allows interrupts

Void GenInterrupt (int INTR_NUM) Performs the software interrupts specified by INTR_NUM

Void Interrupt (* getvect (int INTR_NUM)) ()

Returns an interrupt handler for the interrupt number INTR_NUM, for example: OLD_INT_10H = GetVect (0x10);

Void setVect (int INTR_NUM, VOID INTERRUPT (* ISR) ())

The interrupt handler for the interrupt number INTR_NUM is ISR, for example: setVect (0x10, new_int_10h);

Void HardenRR (int (* fptr) ())

Define a hardware error handler, and call the program referred to in the FPTR whenever an error occurs

Void HardResume (int Rescode) hardware error handler

Void HardRetn (int errcode) hardware error handler

INT Inport (int prot) is read from the specified input port and returns this word

INT InportB (int port) is read from the specified input port and returns this byte

Void Outport (int port, int word) Write the word Word to the specified output port Port

Void Outportb (int port, char Byte) Write Byte Byte to the specified output port Port

INT PEEK (Int Segment, unsigned offset)

Function returns segment

One word at the ffset

CHAR PEEKB (Int Segment, unsigned offset)

Function returns segment

One byte at Ffset

Void Poke (int Segment, int offset, char value)

Write the word value to segment

Ffset

Void pokeb (int segment, int offset, int value)

Write byte value to segment

Ffset

Int Randbrd (struct fcb * fcbptr, int recnt)

The function uses the FCB read Reccnt record that opens FCBPTR.

INT RANDBWR (Struct FCB * fcbptr, int RECCNT)

The function writes the RecCnt record in the FCB referred to in FCBPTR to the disk

Void segread (Struct Sregs * segtbl) function puts the current value of the segment register into the structure SegTBL

INT getverify () Take the current state of the inspection mark (0 = inspection is closed, 1 = inspection open)

Void setVerify (int value)

Set the current inspection status, Value is 0 to indicate the shutdown test, to 1 indicate open inspection

INT getcbrk () This function returns the current settings for control interrupt detection

INT setCBRK (int value) This function is used to set the control interrupt to detect when Value = 0 is turned on. When Value = 1, for the detection

INT DOSEXTERR (STRUCT DOSERR * EBLKP) takes an extended error. After the DOS error occurs, this function fills the extended error message in the Doserr structure referred to in EBLKP. This structure is defined as follows:

┌─────────────

│STRUCT DOSERR │

│ {│

│ Int EXTERROR; / * Extension error * / │

│ Char class; / * Error type * / │

│ char action; / * way * / │

│ Char Locus; / * Error Guests * / │

│} │

└─────────────

INT BIOSCOM (INT CMD, CHAR TYPE, INT Port) This function is responsible for communication of data,

CMD can be the following value:

0 Set communication parameters is byte byte value 1 Send characters through communication line output

2 Accept character 3 from communication line Return to the current state of communication

PORT is a communication port, port = 0, the communication port is COM1, and the communication port is COM2 when the port = 1 is pushed.

BYTE is a combination of the following bits for the parameters of transmitting or receiving data:

┌ - ┬────────────────────────────────

│BYTE Value │ Significance │BYTE Value │ Significance │BYTE Value │ Significance │

├─────────────────────────────────────

│0x02 │7 data 位 │0x03 │8 data 位 │0x00 │1 stop bit │

│0x04 │2 Stop bit │0x00 │ No Patient │0X08 │ odd parity │

│0x18 │ Even parity │0x00 │110 baud │0x20 │150 baud │

│0X40 │300 baud │0x60 │600 baud │0x80 │1200 baud │

│0xa0 │2400 baud │0XC0 │4800 baud │0xe0 │9600 baud │

└ - ┴────────────────────────────────

For example: 0xE0 | 0x08 | 0x00 | 0x03 means that the communication port is 9600 baud, odd parity, 1 stop,

8 Data Bit. Function Return value is a 16-bit integer, defined as follows:

15th time

14th transfer shift register empty

Section 13 Transfer fixed registers

12th interrupt detection

11th frame error

10th parity error

9th overload error

8th data ready

7th bit receiving line signal detection

6th ring indicator

5th bit data setting ready

4th clearance

3rd bit Δ receiving line signal detector

2nd drop edge ring detector

The first Δ data setting ready

0th bit Δ clearance transmission

Int BiosDisk (int CMD, Int Drive, Int Head, int track, int sector, int nsects, void * buffer)

This function is used to operate a certain operation for the drive, the CMD is the function number, which is the drive letter (0 = a, 1 = b, 0x80 = c, 0x81 = d, 0x82 = e, etc.). Cmd can be the following value:

0 Reset Soft Disk System. This forces the drive controller to perform hard reset. Ignore all other parameters.

1 Return to the last hard disk operation status. Ignore all other parameters

2 Read one or more disk sectors to memory. The sector read is given by Head, Track, Sector. The sector number is given by nsects. Read 512 bytes of data in each sector into buffer

3 Write one or more sectors from memory read data. The sector written by Write is given by Head, Track, and Sector. The sector number is given by nsects. Write data in Buffer, 512 bytes per sector.

4 Test one or more sectors. Start the sector by Head, Track, Sector. The sector number is given by nsects.

5 Format a track, which is given by Head and Track. Buffer points a table to the sector header written on the specified track. The following CMD values ​​are only allowed for XT or AT microcomputers:

6 Format a track and set a bad sector sign.

7 Format the beginning of the drive on the specified track.

8 Returns the current drive parameter, the drive information returns to the buffer (indicated in four bytes).

9 Initialize a pair of driver characteristics. 10 Execute a long reading, read 512 plus 4 additional bytes per sector

11 Execute a long writing, each sector writes 512 plus 4 additional bytes

12 Execute a disk lookup

13 alternate disk reset

14 read sector buffer

15 write sector buffer

16 Check if the specified drive is ready

17 Review Drive

18 controller RAM diagnosis

19 Drive diagnostics

20 controller internal diagnosis

The function returns a status byte that is combined by the following bits:

0x00 operation success

0x01 bad command

0x02 address tag can't be found

0x04 record can't find

0x05 reset failed

0x07 driver parameter event failed

0x09 attempt DMA through 64K limit

0x0b check bad disk tag

0x10 bad ECC reads on disk

0x11 ECC calibration data error (note it is not an error)

0x20 controller failed

0x40 lookup failed

0x80 response connection failed

0xbb has no definition error

0xFF read operation failed

INT Biodquip ()

Check the device, the function returns a byte, which represents a message, as follows:

15th printing machine number

14th printer number

The 13th is not used

12th connection game I / O

11th RS232 port number

The 8th is not used

7th soft disk number

The sixth soft disk number,

00 is No. 1 drive, 01 is 2 drivers, 10 is a 3-digit drive, 11 is a drive

5th initialization

4th display mode

00 is not used, 01 is 40X25BW color display card

10 is 80x25bw color display card, 11 is 80x25bw monochrome display card

3rd mother sections

The second random memory capacity, 00 is 16K, 01 is 32K, 10 is 48K, 11 is 64K

1st floating point shared processor

0th bitsource from soft disk

INT BIOSKEY (INT CMD) This function is used to perform various keyboard operations, determined by CMD.

CMD can be the following value:

0 Returns the next button on the keyboard. If the low 8 bits are non-0, it is an ASCII character; if the low 8 bits are 0,

Then return the expanded keyboard code.

1 Test if the keyboard can be used to read. Returns 0 indicates that there is no key to be available; otherwise returns the next knock key value.

The knock key itself keeps the value returned by the Bioskey, which is 0, the CMD value of the next call.

2 Return to the current keyboard status, indicated by each bit of returning an integer, see the table below:

┌ - ┬─────────────────────────

│ 位 │ 0 意 意 │ 1 1 意 意 │

├─────────────────────────────

│ 7 │ Insert Status │ Rewriting Status │

│ 6 │ Upoxhip Status │ Small-write Status │

│ 5 │ Digital status, Numlock Lights Light │ Corbizitor status, Numlock Lights Off Offer │

│ 4 │crolllock lights Light │ScrollLock Lights Off Off Offer │

│ 3 │ALT Press │ALT Unpaid │

│ 2 │CTRL Press │CTRL Not Push │

│ 1 │ Left SHIFT Press │ Left Shift Unforcence │

│ 0 │ Right SHIFT Press │ Right Shift Unforcence │

└ - ┴─────────────────────────

INT BiosMemory () returns memory size to K.

INT BiospRINT (int CMD, int Byte, int port) controls the input / output of the printer.

Port is the printer number, 0 is LPT1, 1 is LPT2, 2 is LPT3, etc.

CMD can be the following value:

0 Print characters, send characters Byte to the printer

1 Printer port initialization

2 read printer status

Function return value consists of the following bit value indicates the current printer status

0x01 device time timeout

0x08 input / output error

0x10 selected

0x20 paper paper

0x40 recognition

0x80 is not busy

INT Biostime (int CMD, long newtime timer control, cmd is function number, can be the following

0 Function Returns the current value of the timer 1 Set the timer to the new value newtime

Struct Country * Country (int COUNTRYCMODE, STRUCT country * countryp)

This function is used to control information about a country, such as date, time, currency, etc.

If Countryp = -1, the current country is set to countrycode value (must be non-0). Otherwise, the country structure pointed to by Countryp is filled with the following national information:

(1) The current country (if countrycode is 0 or 2), the country given by CountryCode.

The structural country is as follows:

┌ --────────────────────────────

│STRUCT Country │

│ {│

│ INT CO_DATE; / * Date format * / │

│ Char Co_Curr [5]; / * Currency Symbol * / │

│ Char co_thsep [2]; / * Digital Division * / │

│ Char Co_DeSep [2]; / * Dadix point * / │

│ Char Co_dtsep [2]; / * Date Separator * / │

│ char CO_TMSEP [2]; / * Time Division * / │

│ char CO_CURRSTYLE; / * Monetary Form * / │

│ Char Co_Digits; / * Valid Number * / │

│ INT (FAR * CO_CASE) (); / * Event Processing Function * / │

│ Char Co_Dasep; / * Data Separator * / │

│ Char CO_FILL [10]; / * Supplemental Character * / │

│} │

└ --────────────────────────────

The date format represented by the value of CO_DATE is:

0 months, 1st, month, 2nd

The currency display of the value of CO_CURRSTRLE is the way

0 currency symbols in front of the value, there is no space in the middle

1 Currency symbol After the value, there is no space in the middle

2 Currency symbols in front of the value, there is space in the middle

3 After the currency symbol is in the value, there is a space in the middle.

Operating function, the function library is string.h, mem.h

MEM ... operation storage array

Void * Memccpy (Void * Destin, Void * Source, unsigned char ch, unsigned n)

Void * Memchr (void * s, char ch, unsigned n)

Void * Memcmp (Void * S1, Void * S2, Unsigned N)

INT MemicMP (Void * S1, Void * S2, Unsigned N)

Void * Memmove (Void * Destin, Void * Source, unsigned n)

Void * Memcpy (Void * Destin, Void * Source, unsigned n)

Void * Memset (void * s, char ch, unsigned n)

These functions, all members of the MEM ... series are operated in stores. In all of these functions, arrays are N-bytes long.

Memcpy Copys a n-byte block from Source to Destin. If the source block and the target block are overlap, select the replication direction to correctly copy the overlay bytes.

Memmove is the same as Memcpy. MEMSET places all the words S in byte CH. The length of the number group is given by n.

Memcmp is exactly the two strings S1 and S2 of the N-byte lengths. Some functions are comparing bytes in unsigned characters, so

Memcmp ("0xFF", "/ x7f", 1) The return value is greater than 0. MemicMP compares the first n bytes of S1 and S2, regardless of character capital or lowercase.

Memccpy From the Source Copy byte to Destin. The following is the following:

(1) Character CH preferred copy to DESTIN.

(2) N bytes have been copied to Destin.

Memchr retrieves the first n byte of the S array for character CH.

Return Value: Memmove and Memcpy Return Destin

MEMSET Returns the value of S

Memcmp and Memicmp─ ┬─ S1

├若 If S1 = S2 return value is equal to 0

└─ If S1> S2 return value is greater than 0

If Memccpy copies CH, return to a pointer to the byte in Destin directly following CH; otherwise return NULL

Memchr Returns a pointer to the CH in S; if CH does not appear in the S array, returns NULL.

Void MoveData (int SEGSRC, int offsrc, int segdest, int offdest, unsigned numbytes)

This function will be the source address (SEGSRC

NumBytes by FFSRC) Copy to the target address (SEGDEST)

Ffdest)

Void MoveMem (Void * Source, Void * Destin, Unsigned Len)

This function is replicated from the Source to Destin. If the source address and the target address string are overlap, select the replication direction to correctly copy the data.

Void setmem (void * addr, int Len, char value)

This function places the first byte of the block referred to in the ADDR in byte Value.

STR ... string operation function

CHAR STPCPY (CHAR * DEST, Const Char * src) Copy the string SRC to DEST

Char strcat (char * dest, const char * src) Adds string src to the end of DEST

CHAR STRCHR (const char * s, int c) retrieves and returns the first place in the string S in the string S

INT STRCMP (const char * s1, const char * s2) The size of the strings S1 and S2 is compared and returns S1-S2

CHAR STRCPY (CHAR * DEST, Const Char * src) Copy the string SRC to DEST

SIZE_T STRCSPN (const char * s1, const char * s2) Scan S1, returns in S1, there are also characters in S2

Char strdup (const char * s) copies string S to the recently established unit

INT STRICMP (Const Char * S1, Const Char * S2) Compare strings S1 and S2, and return S1-S2

SIZE_T STRLEN (const char * s) Returns the length of string S

Char strlwr (char * s)

Convert all uppercase letters in the string S to lowercase letters and return the conversion string

Char Strncat (Char * Dest, Const Char * src, size_t maxlen)

Copy the most Maxlen characters in the string SRC to the string DEST

INT STRNCMP (Const Char * S1, Const Char * S2, SIZE_T MAXLEN)

Comparison string S1 and front Maxlen characters in S2

Char Strncpy (Char * Dest, Const Char * src, SIZE_T MAXLEN)

Copy the front Maxlen characters in the SRC to DEST

Int StrnicMP (const char * s1, const char * s2, size_t maxlen)

Comparison string S1 and front Maxlen characters in S2

Char strnset (Char * S, INT CH, SIZE_T N)

Place the front n character of the string S in CH

Char Strpbrk (const char * s1, const char * s2)

Scan string S1 and return the number of characters all in S1 and S2

CHAR STRRCHR (const char * s, int C)

Scan a string S for a given character C

Char Strrev (Char * S)

Return all characters in the string s to rearrange the characters and return the arranged string

Char strset (Char * S, INTC)

Place all characters in a string S in a given character CH

SIZE_T STRSPN (Const Char * S1, Const Char * S2)

Scan string S1 and return the number of characters all in S1 and S2

CHAR STRSTR (const char * s1, const char * s2) Scan string S2 and returns the position of the S1 appears in the first time

Char Strtok (Char * S1, Const Char * S2)

Retrieve string S1, the string S1 is separated by the delimiter defined in the string S2

Char strupr (char * s)

Convert all lowercase letters in the string S to uppercase letters and return the conversion string

Storage distribution subroutine, the library is dos.h, alloc.h, malloc.h, stdlib.h, process.h

Int Allocmem (unsigned size, unsigned * seg)

Using DOS assignment of idle memory, size is allocated memory size, SEG is a memory pointer that is allocated.

INT FreeMem (unsigned seg)

Release the memory allocated by allocmem, SEG is the specified memory pointer

Int setBlock (int seg, int news)

This function is used to modify the assigned memory length, and the seg is the memory pointer that has been allocated, and newsize is the new length.

INT brk (void * endds)

This function is used to change the number of spaces that assigned to the data segment of the calling program, the new space end address is endds

Char * SBRK (INT INCR)

This function is used to increase the number of spaces assigned to the data segment of the calling program, increasing the space of the INCR byte.

Unsigned long coreleft () This function returns the length of the unused storage area, in bytes

Void * Calloc (unsigned nlem, unsigned)

Assign the NELEM length of the memory space of Elsize and returns the pointer to the assigned memory

Void * malloc (unsigned size) assigns the memory space of the SIZE byte and returns the pointer to the assigned memory

Void Free (void * ptr) releases the memory allocated before, the pointer to the memory to be released is Ptr

Void * Realloc (Void * PTR, Unsigned Newsize)

Changing the size of the assigned memory, PTR is a pointer that has been assigned with a memory area, and NewSIze is a new length, returns the allocated memory pointer.

Long farcoreleft () This function returns the length of the stored storage area in the distortion, in bytes

Void Far * Farcalloc (unsigned long units, unsigned long units)

Assign Units from the far-resence of Units Units, and returns the pointer assigned memory

Void * Farmalloc (unsigned long size)

Assign the memory space of the SIZE byte and return allocated memory pointers

Void Farfree (Void Far * Block)

Release the memory space previously assigned from the far, the pointer to the far-resembled memory is block

Void Far * FarRealloc (Void Far * Block, unsigned long newsize)

Change the size of the allocated far, block is a pointer that has been assigned with a memory area, and newzie is a new length, returns allocated memory pointers.

Time date function, function library is Time.h, dos.h

In the time dates function, the main use structure has the following:

Total time date Storage structure TM

┌───────────────────

│STRUCT TM │

│ {│

│ INTTM_SEC; / * Second, 0-59 * / │

│ INTTM_MIN; / * points, 0-59 * / │

│ INTTM_HOUR; / *, 0-23 * / │

│ INTTM_MDAY; / * Number, 1-31 * / │

│ INTTM_MON; / * Month, 0-11 * / │

│ INTTM_YEAR; / * Since 1900's number of days * / │

│ INT TM_WDAY; / * Since the day of the day 0-6 * / │

│ INTTM_YDAY; / * Since January 1st, 0-365 * / │

│ INTTM_ISDST; / * Do you use a summer time to use a positive number * / │

│} │

└───────────────────

Date Storage Structure Date

┌─────────────

│STRUCT DATE │

│ {│

│ INT Da_Year; / * Since 1900's number of days * / │

│ Char da_day; / * days * / │

│ Char Da_MON; / * Month 1 = jan * / │

│} │

└─────────────

Time Storage Structure TIME

┌─────────────

│STRUCT TIME │

│ {│

│ unsigned char TI_MIN; / * Minute * / │

│ unsigned char Ti_HOUR; / * Hours * / │

│ unsigned char Ti_hund; │

│ unsigned char Ti_sec; / * 秒 * / │

│ │

└─────────────

Char * CTIME (long * clock)

This function converts the time referred to in the Clock (such as the time returned by the function time) into a string of the following format:

MON NOV 21 11:31:54 1983 / N / 0

Char asctime (struct tm * tm)

This function converts the specified TM structure class into the string of the following format:

MON NOV 21 11:31:54 1983 / N / 0

Double DiffTime (Time_t Time2, Time_t Time1)

Calculate the time gap between TIME2 and TIME1 (in seconds)

StructTM * GMTIME (long * clock)

This function converts the time referred to in Clock (if the time returned by the function time) into Greenwich time, and returned in the form of a TM structure

StructTM * LocalTime (long * clock)

This function converts the time (such as the time returned by the function time) into a local standard time, and returns in the form of a TM structure

Void Tzset () This function provides compatibility to UNIX operating systems

Long Dostounix (Struct Date * Dateptr, Struct Time * TimePtr)

This function converts the date referred to by DATEPTR to UNIX format, and returns from Greenwich time to the current number of seconds in the early morning of January 1, 1970

Void Unixtodos (Long Utime, Struct Date * DatePtr, Struct Time * TimePtr)

This function will play since Greenwich Time from January 1, 1970 to the current number UTIME to convert into a DOS format and save the structure of the user to DatePtr and TimePtr

Void getDate (struct date * dateblk)

This function writes the date of the computer in DateBLK for users to use

Void setDate (struct date * dateblk)

This function changes the date within the computer to the date specified by the structure DATEBLK

Void getTime (Struct Time * Timep)

This function writes the time within the computer to the structure Time for use by the user.

Void SetTime (Struct Time * Timep)

This function changes the time within the computer to the time referred to by the structure TimeP.

Long Time (long * tloc)

This function gives the number of seconds passing from the early morning of January 1, 1970, and stores this value in the unit referred to in TLOC.

INT STIME (long * tp) This function writes the time referred to by Tp (for example, the time returned by TIME) into the computer.

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

New Post(0)