C library function manual

xiaoxiao2021-03-06  92

C library function manual 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

INT IsalNum (INT CH) If CH is a letter ('A' - 'Z', 'A' - 'Z') or Number ('0' - '9')

Return to a 0 value, otherwise returns 0

INT Isascii (int CH) If the CH is a character (0-127 in the ASCII code) returns a non-0 value, otherwise returns 0

INT ISCNTRL (INT CH) If CH is a waste character (0x7F) or normal control character (0x00-0x1f)

Return to a 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 Isgraph (int CH) If the CH is a printable character (excluding space) (0x21-0X7E) returns a non-0 value, otherwise returns 0

INT Islower (INT CH) If the CH is lowercase letters ('A' - 'Z') returns a non-0 value, otherwise returns 0

INT Isprint (int CH) If the CH is a printable character (including the empty grid) (0x20-0x7e) Returns a non-0 value, otherwise returns 0

INT ISPUNCT (INT CH) Returns 0 value if the CH is the punctuation character (0x00-0x1f), otherwise returns 0

INT ISSPACE (INT CH) If CH is space (''), horizontal tab ('/ t'), carriage return ('/ r'),

Papermail wrap ('/ f'), vertical tab ('/ v'), newline character ('/ n')

Return to a 0 value, otherwise returns 0

Int IsUpper (int CH) If the CH is uppercase letters ('A' - 'Z') returns a non-0 value, otherwise returns 0

INT Isxdigit (INT CH) Returns non-zero value ('0' - '9', 'A' - 'f', 'A' - 'F') is returned to non-zero.

Otherwise returning 0

INT TOLOWER (INT CH) If CH is uppercase letters ('A' - 'Z') returns the corresponding lowercase letters ('A' - 'Z')

INT Toupper (int CH) Returns the corresponding uppercase letters ('A' - 'Z') in lowercase letters ('A' - 'Z')

Mathematical functions, the library is math.h, stdlib.h, string.h, float.h

INT ABS (INT i) returns an absolute value of integer parameter i

Double Cabs (STRUCT Complex Znum) Returns the absolute value of the recoverable Znum

Double Fabs (double x) Returns the absolute value of the double precision parameter x

Long Labs (long n) returns absolute value of long integer parameter n

Double EXP (double x) Returns the value of the index function EX

Double Frexp (Double Value, INT * EPTR) Returns the value of X in Value = X * 2N, N storage in EPTR

Double LDEXP (Double Value, Int Exp); Returns Value * 2EXP value

Double log (double x) Returns the value of LOGEX

Double log10 (double x) Returns the value of log10x

Double Pow (double x, double y) Returns the value of XY Double Pow10 (INT P) Returns 10P value

Double SQRT (Double X) Returns √x value

Double ACOS (Double X) Returns the anti-residue COS-1 (X) value of X, X is curved

Double Asin (double x) Returns the X of the X-Sin Sin-1 (X) value, X is an arc

Double Atan (double x) Returns the Untifregate Tan-1 (x) value of X, X is curved

Double Atan2 (Double Y, Double X) Returns Y / X Anytitate Tan-1 (x) value, Y X is an arc

Double Cos (Double X) Returns the cosine COS (X) value of X, X is curvature

Double Sin (double x) Returns the sinusoidal SIN (X) value of X, X is curvature

Double Tan (double x) Returns the orthosis TAN (X) value of X, X is an arc

Double Cosh (double x) Returns the double cosine COSH (X) value of X, X is curved

Double SINH (Double X) Returns the dual sinusoid SINH (X) value of X, X is curved

Double Tanh (Double X) Returns the double-dicing Tanh (X) value of X, X is curved

Double Hypot (double x, double y) Returns the length (z) of the right-angle triangle.

X and Y are the length of the straight angle, Z2 = x2 Y2

Double CEIL (Double X) Returns minimal integers of not less than X

Double Floor (double x) returns the maximum integer of no more than x

Void SRAND (unsigned seed) initializes the random number generator

INT rand () generates a random number and returns this number

Double Poly (Double X, INT N, Double C []) generates a multiplicity from the parameter

Double MODF (Double Value, Double * iptr) decomposes the double-precision value Value into the mantissa and the order

Double FMOD (double x, double y) Returns the remainder of X / 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) Converts the string NPTR into an integer and returns this integer

Double Atol (Char * NPTR) converts the string NPTR to grow integers and return this integer

Char * ECVT (Double Value, Int NDIGIT, INT * DECPT, INT * SIGN)

Convert the floating point value VALUE into a string and returns the string

Char * FCVT (Double Value, Int Ndigit, INT * DECPT, INT * SIGN)

Convert the floating point value VALUE into a string and returns the string

Char * GCVT (Double Value, int NDIGIT, CHAR * BUF)

Converting the number Value into a string and stored in BUF, and returns the pointer of the BUF

Char * Ultoa (unsigned long value, char * string, int RADIX) converts unsigned integer values ​​into a string and returns the string, and RADIX is the base of the conversion.

Char * LTOA (Long Value, Char * String, int RADIX)

Convert long-shaped value VALUE into a string and return the string, and Radix is ​​the base of the conversion.

Char * ITOA (int value, char * string, int radix)

Converting the integer value into a string to store String, and RADIX is the base of the conversion.

Double Atof (Char * NPTR) converts the string nptr into a double precision number and returns this number, the error returns 0

INT ATOI (Char * NPTR) Converts the string nptr into an integer, returns this number, error returns 0

Long atol (char * nptr) converts the string NPTR to grow the total number and return this number, the error returns 0

Double Strtod (Char * Str, Char ** Endptr) converts the string STR into double-precision and returns this number,

Long Strtol (CHAR * STR, Char ** Endptr, Int Base) Converts the string STR to grow the number,

And return this number,

INT MatherR (Struct Exception * E)

User modify mathematics error returns information function (no need to use)

Double _Matherr (_Mexcep why, char * fun, double * arg1p,

Double * Arg2P, Double RetVal

User modify mathematics error returns information function (no need to use)

Unsigned int _clear87 () Clear the floating point status word and return the original floating point status

Void _fpreset () Reproduces the floating point mathematics package

Unsigned int _status87 () Returns floating point status word

Directory function, the function library is dir.h, dos.h

INT ChDIR (CHAR * PATH) turns the specified directory PATH (eg "C: // WPS") into the current working directory,

Gong returns 0

INT FINDFIRST (CHAR * PATHNAME, STRUCT FFBLK * FFBLK, INT Attrib) Find the specified file, success

Return 0

Pathname is 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:

┏┏━━━━━━━━━━━━┓┓┓┓┓

Struct Ffblk

┃ {┃

CHAR FF_RESERVED [21]; / * DOS reserved word * /

CHAR FF_ATTRIB; / * File Attributes * / Ou

INT ff_ftime; / * file time * /

INT ff_fdate; / * file date * /

Long ff_fsize; / * file length * /

Char ff_name [13]; / * file name * /

}

┗┗━━━━━━━━━━━━┛┛┛┛┛

Attrib is file properties, represented by the following characters

┏┏━━━━━━┳┳┳━━━━━━┓┓

Fa_rdonly read-only file f_Label volume marking number

Fa_hidden hidden file Fa_direc directory

Fa_system system file Fa_arch file

┗┗━━━━━━┻┻┻━━━━━━┛┛

example:

Struct ffblk ff;

Findfirst ("*. WPS", & ff, fa_rdonly);

INT FINDNEXT (STRUCT FFBLK * FFBLK) Repeates the file with Findirst, and successfully returns 0void FuMerge (Char * Path, Char * Drive, Char * Dir, Char * Name, Char * EXT)

This function passes the drive from Drive (C:, A:, etc.), path DIR (/ TC, / BC / LIB, etc.),

File name Name (TC, WPS, etc.), extension ext (.exe, .com, etc.) form a file name

There is a PATH.

INT FNSPLIT (Char * Path, Char * Drive, Char * Dir, Char * Name, CHAR * EXT)

This function breaks down the file name Path to the disk letter DRIVE (C:, A:, etc.), path DIR (/ TC, / BC / LIB, etc.),

File name Name (TC, WPS, etc.), extension ext (.exe, .com, etc.) and store the corresponding variables separately.

INT getCurdir (int DRIVE, CHAR * DIREC) This function returns the current work directory name of the specified drive

Drive Specifies the drive (0 = Current, 1 = A, 2 = B, 3 = C, etc.)

Direc Saves the variable of the current working path of the drive to returns 0

Char * getCwd (char * buf, iont n) This function takes the current working directory and stores in BUF until n word

Skille. Error Back Null

INT getDisk () takes an integer (0 = A, 1 = B, 2 = C, etc.)

INT setDisk (int DRIVE) Set the drive Drive (0 = a, 1 = B, 2 = C, etc.),

Returns the total number of drivers that can be used

INT MKDIR (Char * Pathname) establishes a new directory Pathname, successfully returns 0

INT RMDIR (Char * Pathname) Delete a directory Pathname, successfully returned 0

Char * mktemp (char * template) Constructs a file name not in a current directory and stored in Template

Char * searchPath (Char * Pathname) uses MSDOS to find the path of file filename,

This function uses DOS's PATH variable, not finding a file back NULL

Process function, the function library is stdlib.h, process.h

Void Abort () This function writes a termination information in stderr by calling _exit with export code 3.

And the procedure is terminated. No return value

Int Exec ... loading and running other programs

Int Execl (Char * Pathname, Char * Arg0, Char * Arg1, ..., Char * Argn, ​​NULL

Int exec (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 parameters

Arg0 (arg1, arg2, argv [], envp []) passed to 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 a suffix P, which can look up the subroutine file with the PATH variable of DOS.

l When the number of parameters transmitted in the function is fixed.

v When the function passed is not fixed.

E When the function passes the specified parameter ENVP, allowing the environment that allows the sub-process,

When the suffix E, the child process uses the current program environment.

Void_exit (int status) terminates the current program, but does not clean up the site

Void exit (int stat) terminates the current program, close all files, write the output of the buffer (wait for the output),

And call any "exit function", no return value

INT SPAWN ... Runs

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 family runs the subroutine Pathname in the Mode mode, and will parameters

Arg0 (arg1, arg2, argv [], envp []) passes to subroutines. Error returns -1

Mode is a mode of operation

Mode is represented by the p_wait to return this program after running the subroutine.

P_nowait indicates that the program is running at the same time (not available)

P_overlay means run a subscriber after this program exits

In the spawn function family, the suffix L, V, P, and E are added to the spawn,

The specified function will have some kind of ability

When there is a suffix P, the function uses DOS's Path to find the subroutine file.

l When the function passes the number of parameters fixed.

v When the function passes the number of parameters is not fixed.

E When the specified parameter ENVP can be passed to the subroutine, allowing the subroutine operating environment.

When there is no bonus E, the subroutine uses the environment 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.h

Char * ECVT (Double Value, Int NDIGIT, INT * DECPT, INT * SIGN)

Convert the floating point value VALUE into a string and returns the string

Char * FCVT (Double Value, Int Ndigit, INT * DECPT, INT * SIGN)

Convert the floating point value VALUE into a string and returns the string

Char * GCVT (Double Value, int NDIGIT, CHAR * BUF)

Converting the number Value into a string and stored in BUF, and returns the pointer of the BUF

Char * Ultoa (unsigned long value, char * string, int RADIX)

Convert unsigned integer value into a string and return the string, and Radix is ​​the base of the conversion.

Char * LTOA (Long Value, Char * String, Int Radix) Converts Long Integer VALUE into a string and returns the string, and RADIX is the base of the conversion.

Char * ITOA (int value, char * string, int radix)

Converting the integer value into a string to store String, and RADIX is the base of the conversion.

Double Atof (Char * NPTR) converts the string nptr into a double precision number and returns this number, the error returns 0

INT ATOI (Char * NPTR) Converts the string nptr into an integer, returns this number, error returns 0

Long atol (char * nptr) converts the string NPTR to grow the total number and return this number, the error returns 0

Double Strtod (Char * Str, Char ** Endptr) converts the string STR into double-precision and returns this number,

Long Strtol (CHAR * STR, Char ** Endptr, Int Base) Converts the string STR to grow the number,

And return this number,

Int toascii (int C) Returns C 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 CH corresponding lowercase letters ('A' - 'Z')

INT Toupper (int CH) Returns the corresponding uppercase letters ('A' - 'Z') ('A' - 'Z')

INT _TOUPPER (INT CH) Returns CHD corresponding uppercase letters ('A' - 'Z')

Diagnostic function, the library is assert.h, Math.h

Void assert (int test) is a macro extends as an IF statement, if the TEST test failed,

Display an information and terminate the program, no return

Void Perror (Char * String) This function will display the most recent error message, the format is as follows:

String string: Error message

Char * strerror (char * str) This function returns the most recent error message, the format is as follows:

String Str: Error message

INT MatherR (Struct Exception * E)

User modify mathematics error returns information function (no need to use)

Double _Matherr (_Mexcep why, char * fun, double * arg1p,

Double * Arg2P, Double RetVal

User modify mathematics error returns information function (no need to use)

Enter the output subroutine, the library is IO.H, Conio.h, Stat.h, dos.h, stdio.h, sternal.h

INT kbhit () This function returns the recently knocked button

INT fgetchar () reads a character from the console (keyboard), displayed on the screen

INT getch () reads a character from the console (keyboard), not displayed on the screen

INT PUTCH () writes a character to the console (keyboard)

INT getChar () reads a character from the console (keyboard), displayed on the screen

INT PUTCHAR () writes a character to the console (keyboard)

INT getche () reads a character from the console (keyboard), displayed on the screen

INT UNGETCH (INT C) returns the character C back to the console (keyboard)

Char * cgets (char * string) reads the string from the console (keyboard) in String

INT scanf (char * format [, argument ...] reads a string from the console and performs each parameter separately

Assignment, use BIOS to output

INT VSCANF (Char * Format, Valist Param) reads a string from the console, assigns each parameter, output using the BIOS, the parameters get from the Valist Param

INT CSCANF (Char * Format [, Argument ...] reads a string from the console, and each parameter is performed separately

Assign the value, directly on the control table, such as the display when the display is displayed during display, is displayed.

INT SSCANF (Char * String, Char * Format [, Argument, ...]) passes the string String, respectively

Parameter assignment

INT Vsscanf (Char * String, Char * Format, Vlist Param) passed string String, respectively

Parameters are assigned, and the parameters have obtained from VLIST PARAM

INT PUTS (CHAR * STRING) Demand a string string to the console (display),

Use BIOS to output

Void CPUTS (Char * String) Sends a string string to the console (display),

Directly to control Taiwan work, such as the display is displayed directly

INT Printf (Char * Format [, Argument, ...]) Sends a formatted string output to the console (display)

Use BIOS to output

INT Vprintf (Char * Format, Valist Param) Sends a formatted string output to the console (display)

Use the BIOS to output, the parameters have obtained from the Valist Param

INT CPRINTF (Char * Format [, Argument, ...]) Sends a format string to output to the console (display),

Directly to control Taiwan work, such as the display is displayed directly

INT VCPrintf (Char * Format, Valist Param) Sends a formatted string to output to the console (display),

Directly to control the control table, such as the display is displayed directly,

Parameters get from Valist Param

INT Sprintf (char * string, char * format [, argument, ...])

Reconnect the contents of the string string as a formatted string

Int vsprintf (Char * String, Char * Format, Valist Param)

Rewote the content of the string string as a string after formatting, and the parameters get from the Valist Param.

INT RENAME (Char * OldName, Char * NewName) change the name of the file oldname to NewName

INT 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 │ Setting up Equipment Information │

│ 2 │ Read the argcx byte into the address referred to by argdx │

│ 3 │ Write the address of Argdx Write Argcx byte │

│ 4 │ In addition to handle as a device number (0 = current, 1 = A, etc.), all the same is true when cmd = 2 │

│ 5 │ In addition to the handle as a device number (0 = current, 1 = a, etc.), both CMD = 3 when │

│ 6 │ Take Input Status ││ 7 │ Take Output Status │

│ 8 │ Test interchangeability; only for DOS 3.x │

│ 11 │ Set the rejection count of sharing conflicts; only for DOS 3.x │

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

INT (* Ssignal (int SiG, int (* action) ()) () executes software signals (no need to use)

INT GSIGNAL (int SIG) performs software signals (no need to use)

INT _OPEN (CHAR * PATHNAME, INT Access) opens a file for reading or writing,

Press after pressing Access to determine whether reading a file or write file, Access value see the table below

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

│ Access Value │ Significance │

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

│O_RDONLY │ Read File │

│O_Wronly │written file │

│O_RDWR │ 即 read and write │

│O_NOINHERIT │ If the file is not passed to a subroutine, it is included │

│O_DENYALL │ only allows the currently handled file │

│O_DenyWrite │ only allows file readings from any other open file │

│O_DENYREAD │ only allows for files from any other open file │

│O_Denynone │ Allows other shared files │

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

INT Open (char * pathname, int access [, int permiss]) opens a file for reading or writing,

Press after pressing Access to determine whether reading a file or write file, Access value see the table below

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

│ Access Value │ Significance │

├──────────────────── ─ ┤

│O_RDONLY│T reading file │

│O_WRONLY│Wick file │

│O_RDWR │ 即 read and write │

│O_NDELAY│No; Compatible with UNIX System │

│O_Append│ 即 读 也 也, but each time you write always add │

│O_CREAT │ If the file exists, this flag is useless; if there is no existence, new files │

│O_TRUNC │ If the file exists, the length is cut 0. The property is unchanged │

│O_EXCL │ unused; Neix System Compatibility │

│O_BINARY│ This flag can be displayed in binary to open the file │

│O_TEXT │ This flag can be used to show the text mode to open file │

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

Permiss is file properties, which can be the following values:

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

INT Creat (Char * FileName, INT Permiss) establishes a new file filename and sets read and write. Permiss is a file read and write, which can be the following

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

INT_CREAT (CHAR * FileName, int Attrib) Create a new file filename, and set files

Attributes. Attrib for file properties, you can

FA_RDONLY read-only FA_HIDDEN hides the FA_SYSTEM system

INT Creatnew (int Attrib) Create a new file filename and sets the file

Attributes. Attrib for file properties, you can

FA_RDONLY read-only FA_HIDDEN hides the FA_SYSTEM system

INT CREATTEMP (int Attrib) Create a new file filename and set files

Attributes. Attrib for file properties, you can

FA_RDONLY read-only FA_HIDDEN hides the FA_SYSTEM system

INT Read (Int Handle, Void * BUF, INT NBYTE) reads NBYTE characters from the file number Handle

Save in BUF

INT _READ (int Handle, Void * BUF, INT NBYTE) read NBYTE characters from the file number Handle

Store in BUF and call MSDOS directly.

INT WRITE (INT Handle, Void * BUF, INT NBYTE Write the NBYTE "of the BUF into the file number

In the handle of Handle

INT_WRITE (INT HANDLE, VOID * BUF, INT NBYTE) Write the NBYTE character in BUF to the file number

In the handle of Handle

INT DUP (INT Handle) Copy a file processing pointer Handle, return this pointer

INT DUP2 (INT Handle, INT NewHandle) Copy a file processing pointer handle to NewHandle

INT EOF (int * handle) Checks if the file ends, ends back 1, otherwise return 0

Long FileLength Returns the file length, handle is the file number

Int setMode (int Handle, Unsigned Mode) This function is used to set the file number to play the file number.

Open

INT getftime (int Handle, Struct ftime * ftime) reads the file number of the file number to Handle,

And save the file time in the FTIME structure, successfully returns 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; / * year -1980 * / │

│} │

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

Int setftime (int Handle, Struct ftime * ftime) Overcomes the file number of the file number,

New time is in the structure ftime. Successful returns 0. Structure ftime 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 * / │

│} │

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

Long Lseek (int.comwhere This function will file the file number is a file number

The pointer is moved to the origin of fromwhere.

Seek_set file switch seek_cur Current location SEEK_END file end

Long Tell (int Handle) This function returns the file number of the file number to the file pointer in byte

INT isatty (int Handle) This function is used to take the type of device handle

INT LOCK (INT HANDLE, Long Offset, Long Length) shared a blockade

INT UNLOCK (INT HANDLE, Long Offset, Long Length) Opens blockade shared by file

INT Close (int Handle) Close the file processing represented by Handle, Handle is from _CREAT, CREAT,

Creatnew, CreatTemp, DUP, DUP2, _OPEN, OPEN A file processing obtained

Successfully returns 0 Otherwise, returns -1, available for UNIX systems

INT _close (int Handle) Close the file processing represented by Handle, Handle is from _CREAT, CREAT,

Creatnew, CreatTemp, DUP, DUP2, _OPEN, OPEN A file processing obtained

Successful return 0 Otherwise, returns -1, only for MSDOS systems

FILE * FOPEN (Char * filename, char * type) Opens a file filename, open mode is Type,

And return this file pointer, TYPE can add a suffix for the following string

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

│Type│Transitant │ Text / 2 Enciprical │ Jianxin / Open Old File │

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

│R │ Read │ Text │ Open Old File │

│W │ 写 │ Text │ Construction Document │

│A │ Add │ Text │ If you open, you will open the new │

│R │ Read / Write │ Unlimited │ Open │

│W │ Read / Write │ Not Restriction │ Construction Document │

│A │ Read / Add │ Unlimited │ If you open, you will open the new │

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

The addition of the suffix is ​​T, B. Plus B indicates that the document is operated in binary form, t is not used

Example: ┌ --─────────────────

│ # 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 the stream Stream to String

INT FPUTS (Char * String, File * Stream) Write string String into the stream stream

INT FREAD (Void * PTR, int size, int nitems, file * stream) Read NITEMS from streaming stream

String of the length of Size deposits in PTR

INT FWRITE (Void * PTR, int size, int nitems, file * stream) Writes NITEMS in stream stream

String of the length of size, string in PTR

INT fscanf (file * stream, char * format [, argument, ...]) is in formatted STREAM

Read a string

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

Read a string, the parameters get from Valist Param

Int fprintf (file * stream, char * format [, argument, ...]) will form a character in formatted form

String to the specified stream stream

INT VFPRINTF (File * Stream, Char * Format, Valist Param) to format a character in format

String to the specified stream stream, the parameters get from the Valist Param

INT FSEEK (File * Stream, long offset, int.comwhere "function moves file pointers to fromwhere

The backstarted OFFSET by the location is indicated, 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) Clear Stream Street Read / write error Void SetBuf (File * Stream, Char * BUF) Give Stream Specifies 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) Close a stream and processes the buffer

Treatment, that is, the stream, read the contents of the buffer;

To write the stream, write the contents within the buffer. Success return 0

INT fflushall () Turn off all currents and processes their respective buffers

Treatment, that is, the stream, read the contents of the buffer;

To write the stream, write the contents within the buffer. Success return 0

INT Access (Char * filename, int _) This function checks file filename and returns the properties of the file,

The function stores the attribute in Amode, and the AMODE consists 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.

The function is successfully returned to 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 construct a FAR pointer according to the segment SEG and offset OFF in the far pointer Farptr.

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 referred to 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 read specific

Disk sectors, Drive is driven number (0 = a, 1 = b, etc.), Nsects is the number of sectors to read, and SECTNO is the starting log.

Seaf fan area number, buffer is saving the save space for saving the read data

INT Abswrite (int DRIVE, INT Nsects, int SectNo, Void * Buffer) This function is written

Disk sectors, Drive is driven number (0 = a, 1 = b, etc.), Nsects is the number of sectors to be written, and SECTNO starts logo.

Seaf fan area number, buffer is the space where the data is written

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.). Function In the DFREE structure of the disk characteristic by DFREEP.

The DFREE structure is as follows:

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

│STRUCT DFREE │

│ {│

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

│ unsigned df_total; / * Total cluster number * / │

│ unsigned df_bsec; / * The number of bytes per sector * / │

│ 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 file allocation table information for specified drive Drive (0 = current, 1 = A, 2 = B, etc.)

And stored in 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 stored in 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 * / │

│} │

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

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 the function number.

INT BDOSPTR (INT DOSFUN, VOID * ARGUMENT, Unsiigned Dosal) This function calls 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_NU number interrupt, the user-defined register value is stored in the structure inregs.

After execution, the returned register value is stored in the structure Outregs.

INT INT86X (int INTR_NUM, Union Regs * INREGS, Union Regs * Outregs,

Struct Sregs * Segregs) Execute the INTR_NUM number interrupt, the user-defined register value is stored

In Structure Inregs and Structure Segregs, the returned register value is stored in Outregs after execution.

int INTDOS (Union Regs * Outregs)

This function performs DOS interrupt 0x21 to call a specified DOS function, user-defined register value

Save the structure inRegs, execution of the function will save the returned register value in Outregs

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

This function performs DOS interrupt 0x21 to call a specified DOS function, user-defined register value

Saves Structure Inregs and SegRegs, and the running function will save the returned register value in Outregs.

Void INTR (int INTR_NUM, STRUCT REGPACK * PREG) This function is an alternate 8086 software interrupt interface

It produces an 8086 software interrupt specified by the parameter INTR_NUM. The function is in the execution software interrupt,

The user-defined register value to each register is copied from the structure preg. After the software is broken,

The function is copied to the value of each register to the structure preg. The parameters are as follows:

INTR_NUM is executed interrupt number

PREG is the structure of saving user-defined register values, 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 size) Returns MSDOS in Status Status, but the program remains in memory, accounting for

The space is determined by the SIZE.

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

Void disable () disabled interrupt

Void enable () allows interrupt VOID GENINTERRUPT (INT INTR_NUM) to perform software interrupts specified by INTR_NUM

Void Interrupt (* getVect (int INTR_NUM)) () Returns the interrupt handler for the interrupt number INTR_NUM,

For example: OLD_INT_10H = GetVect (0x10);

Void setVect (int INTR_NUM, VOID INTERRUPT (* ISR) ()) Set the interrupt number INTR_NUM

The break processing program is ISR, for example: setVect (0x10, new_int_10h);

Void Harden (int (* fptr) ()) Defines a hardware error handler.

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 "Returns Segment: A word at Offset

Char peekb (int segment, unsigned offset function returns a segment: a byte at Offset

Void Poke (int segment, int offset, char value) Written the word value to segment: offset

Void pokeb (int segment, int offset, int value) writes byte value to segment: offset

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 Sets the current inspection status,

Value is 0 indicates a closed inspection, and it is 1 to open the inspection.

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

INT setCBRK (int value) This function is used to set control interrupt detection is turned on or disconnected.

When value = 0, it is detected. When Value = 1, for the detection

INT DOSEXTERR (Struct Doserr * EBLKP) takes an extended error. After DOS error, this function will expand

The error message fills in the Doserr structure referred to 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 the communication of data, and 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 Bit │0x03 │8 Data Bit │0x00 │1 Stop Bit │ │

│0X04 │2 Stop bit │0x00 │ No odor │0x08 │ odd parity │ │

│0x18 │ Even parity │0x00 │110 Potter │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 bits.

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, and the cmd is the function number.

Drive 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. Write the sector by Head, Track, Sector

Give it. 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. Sector number

NSECTS is given.

5 Format a track, which is given by Head and Track. Buffer points to write on the specified TRACK

A table of a sector header.

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 () checks 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 values ​​(must be non-0). Otherwise, by countryp

The point-to-one COUNTR 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 to Destin from Source. If the source block and the target block are overlap, select the replication direction.

Copy the overlay by correctly replicate.

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 compared 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─ ┬─ If 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 directly following the bytes in Destin;

Otherwise returning NULL

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

Void MoveData (int SGSRC, INT OFFSRC,

Int segdest, int off offdest,

Unsigned number

This function will use the Numbytes by the source address (segsrc: offsrc)

Copy to the target address (segdest: offdest)

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

This function is copied from the Source to the Data to Destin. If the source address and the target address string

Return, select the replication direction for correct copy 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 string src to DEST

Char strcat (char * DEST, Const Char * SRC)

Add the string SRC to the end of DEST

CHAR STRCHR (const char * s, int C)

Retrieve and return the first place in the string S in the string S

INT STRCMP (Const Char * S1, Const Char * S2)

Compare the size of the strings S1 and S2 and return S1-S2

Char Strcpy (Char * Dest, Const Char * SRC)

Copy 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)

Copy the 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 the 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 primary N characters of the string S in 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 return to the position of S1 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) utilizes DOS to assign idle memory,

Size is allocated memory size, SEG is allocated memory pointer

INT FreeMem (unsigned seg) Releases memory previously 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.

SEG is a memory pointer that has been allocated, Newsize is a 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 Elsize assigns NELEM length to ELSIZE) memory space

And return the pointer of allocated 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 news) Changes the size of the assigned memory, PTR is all assigned

The pointer of the storage area, newsize is a new length, returns allocated memory pointers.

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 Size byte memory space,

And return allocated memory pointers

Void Farfree (Void Far * Block) Releases the memory space previously assigned from the far,

The pointer to the far heap memory to be released is Block

Void Far * FarRealloc (Void Far * Block, unsigned long news "changed the allocated far

The size of the store, Block is a pointer that has been assigned with a memory area, and newzie is a new length, returns allocation.

Memory pointer

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

┌──────────────────── ┐│truct 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 (such as the time returned by the function time) into the following format

String: 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 refers to the time referred to in the clock (such as the time returned by the function time)

Convert to Greenwich Time and return in the form of TM structure

StructTM * localtime (long * clock) This function puts the time referred to in the clock (such as the time returned by the function time)

Convert to local standard time and return in the form of 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 return

Since Greenwich Time, Greenwich January 1st, January 1st, the current number of seconds 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 conversion into

The DOS format is saved in the structure of the user, DatePtr and TimePtr

Void getdate (struct date * dateblk) This function writes the date of the computer Dateblk

Medium for users

Void setDate (struct date * dateblk) This function is changed to the date of the computer

Date specified by Structure Dateblk

Void getTime (STRUCT TIME * TIMEP) This function writes the time in the computer to the structure Timep,

For users to use

Void setTime (STRUCT TIME * TIMEP) This function changes the time within the computer to

Time referred to by structure TIMEP

Long Time (long * tloc) This function gives it from Greenwich Time to January 1st, 1970.

The number of seconds and the value exists in the unit referred to in TLOC.

INT Stime (long * tp) This function will take the time referred to in TP (eg, the time returned by TIME)

Write into the computer.

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

New Post(0)