Categories function, the host library for ctype.h
Int isalpha (int ch) if ch is letters ( 'A'-'Z', 'a'-'z') non-zero return value, or else return 0
Int isalnum (int ch) if ch is letters ( 'A'-'Z', 'a'-'z') or digital ('0 '-'9')
Non-zero return value, or else return 0
Int isascii (int ch) if ch is the character (ASCII code in the 0-127) return 0-value, or else return 0
Int iscntrl (int ch) if ch is void characters (0 x7F) or ordinary control characters (0 x00-0x1F)
Non-zero return value, or else return 0
Int isdigit (int ch) if ch figures ('0 '-'9') non-zero return value, or else return 0
Int isgraph (int ch) if ch can print characters (not including spaces) (0 x21-0x7E) non-zero return value, or else return 0
Int islower (int ch) if ch is lowercase letters ( 'a'-'z') non-zero return value, or else return 0
Int isprint (int ch) if ch can print characters (including spaces) (0 x20-0x7E) non-zero return value, or else return 0
Int ispunct (int ch) if ch is the punctuation characters (0 x00-0x1F) non-zero return value, or else return 0
Int isspace (int ch) if ch is space ( ''), horizontal tabs ( '\ t'), Enter Address ( '\ r'),
Take paper newline ( '\ f'), vertical tabs ( '\ v'), newline ( '\ n')
Non-zero return value, or else return 0
Int isupper (int ch) if ch is the capital letters ( 'A'-'Z') non-zero return value, or else return 0
Int isxdigit (int ch) if ch is 16 hexadecimal ('0 '-'9', 'A'-'F', 'a'-'f') non-zero return value
Otherwise return 0
Int tolower (int ch) if ch is the capital letters ( 'A'-'Z') to return to the corresponding lowercase letters ( 'a'-'z')
Int toupper (int ch) if ch is lowercase letters ( 'a'-'z') to return to the corresponding capital letters ( 'A'-'Z')
Math, the host library for math.h, stdlib.h, string.h, float.h
Int abs (int i) return to the absolute value of an integer parameter i
Double cabs (struct complex znum) return to the absolute value of the plural znum
Double fabs (double x) to return to double-precision parameters of the absolute value of x
Long labs (long n) return to a long integer parameters of the absolute value of n
Double exp (double x) Return to the value of ex exponential function
Double frexp (double value, int * eptr) return value 2n = x * x in the value of n in storage in eptr
Double ldexp (double value, int exp); return to the value of value * 2exp
Double log (double x) Return to the value of logex
Double log10 (double x) Return to the value of log10x
Double pow (double x, double y) return to the values xy
Double pow10 (int p) Return to the value of 10 p
Double sqrt (double x) Return to the value of √ x +
Double acos (double x) Return to the inverse cosine cos x-1 (x) values for x radians
Double asin (double x) return anyway string of sin x-1 (x) values for x radians
Double atan (double x) Return to the anti-tangent tan x-1 (x) values for x radians
Double atan2 (double y, double x) Return to y / x arctangent of the tan-1 (x) value of x is y Radian
Double cos (double x) Return to the cosine x cos (x) values for x radians
Double sin (double x) Return to the sine x sin (x) values for x radians
Double tan (double x) Return to the tangent tan x (x) values for x radians
Double cosh (double x) Return to the hyperbolic cosine cosh x (x) values for x radians
Double sinh (double x) Return to the hyperbolic sine sinh x (x) values for x radians
Double tanh (double x) Return to the hyperbolic tanh x (x) values for x radians
Double hypot (double x, double y) return to the length of right triangle hypotenuse (z),
X and y for the length of rectangular edge, x2 + y2 = z2
Double ceil (double x) Return to not less than the smallest integer x
Double floor (double x) Return to not more than the largest integer x
Void srand (unsigned seed) initialize the random number generator
Int rand () generated a random number and return to the few
Double poly (double x, int n, double c []) from the parameters of a polynomial
Double modf (double value, double * iptr) and double-precision value decomposed into several bands and Mantissa
Double fmod (double x, double y) return to the x / y the remainder of
Double frexp (double value, int * eptr) and double-precision value is divided into several bands and Mantissa
Double atof (char * nptr) will be converted into a string nptr float and return to the float
Double atoi (char * nptr) will be converted into a string nptr integer and return to the integer
Double atol (char * nptr) will be converted string nptr integer and return to growth this Integer
Char * ecvt (double value, int ndigit, int * decpt, int * sign)
Float value will be converted into a string and returns the string
Char * fcvt (double value, int ndigit, int * decpt, int * sign)
Float value will be converted into a string and returns the string
Char * gcvt (double value, int ndigit, char * buf)
Value will be converted into a string of side-by-side buf, and return to the buf pointer
Char * ultoa (unsigned long value, char * string, int radix)
There will be no symbol integer value into a string and returns the string, radix conversion to the base used by the
Char * ltoa (long value, char * string, int radix)
Long integer value will be converted into a string and returns the string, radix conversion to the base used by the
Char * itoa (int value, char * string, int radix)
Integer value will be converted into strings into string, radix conversion to the base used by the
Double atof (char * nptr) will be converted to dual string nptr few precision, and return to this number, the wrong return 0
Int atoi (char * nptr) will be converted into a string nptr integer and return to this number, the wrong return 0
Long atol (char * nptr) string nptr growth integer conversion, and return to this number, the wrong return 0
Double strtod (char * str, char ** endptr) will be converted to dual string str few precision, and return to this number,
Long strtol (char * str, char ** endptr, int base) string str growth integer conversion,
And return to this number,
Int matherr (struct exception * e)
Users modify mathematical error return information function (there is no need to use)
Double _matherr (_mexcep why, char * fun, double * arg1p,
* Arg2p double, double retval)
Users modify mathematical error return information function (there is no need to use)
Unsigned int _clear87 () remove the word floating-point and return to the original state of the floating-point state
Void _fpreset () to the beginning of the floating-point mathematical package
Unsigned int _status87 () returns the word floating-point state
Directory function, which functions as dir.h, dos.h
Int chdir (char * path) to the specified directory path (such as: "C: \ \ WPS") into the current working directory, 10%
Gong return 0
Int findfirst (char * pathname, struct ffblk ffblk *, int attrib) View specified documents success
Return 0
Pathname to the specified directory name and file name, such as "C: \ \ WPS \ \ TXT"
Ffblk designated for the preservation of an information document structure, defined as follows:
┏ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ┓
┃ struct ffblk ┃
┃ (┃
┃ char ff_reserved [21]; / * DOS reserved words * / ┃
┃ char ff_attrib; / * file attributes * / ┃
┃ int ff_ftime; / * document * / ┃
┃ int ff_fdate; / * document * Date / ┃
┃ long ff_fsize; / * length document * / ┃
┃ char ff_name [13]; / * file name * / ┃
┃) ┃
┗ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ┛
Attrib document attributes, representatives from the following characters
┏ ━ ━ ━ ━ ━ ━ ━ ━ ━ ┳ ━ ━ ━ ━ ━ ━ ━ ━ ┓
┃ FA_RDONLY read-only document ┃ FA_LABEL volume labeling ┃
┃ FA_HIDDEN hidden files directory ┃ ┃ FA_DIREC
┃ FA_SYSTEM system files ┃ FA_ARCH files ┃
┗ ━ ━ ━ ━ ━ ━ ━ ━ ━ ┻ ━ ━ ━ ━ ━ ━ ━ ━ ┛
Example:
Struct ffblk ff;
Findfirst ( "*. wps", & ff, FA_RDONLY);
Int findnext (struct ffblk * ffblk) the matching finddirst document, the successful return 0
Void fumerge (char * path, drive char *, char * dir, char * name, ext char *)
This function through the drive letter (C:, A:, etc.), the path dir (\ TC, \ BC \ LIB),
Name the file name (TC, WPS), ext extension (. EXE,. COM, and so on) the formation of a file name
And the path of depositors.
Int fnsplit (char * path, drive char *, char * dir, char * name, ext char *)
This function path to the file name is decomposed into drive letter (C:, A:, etc.), the path dir (\ TC, \ BC \ LIB),
Name the file name (TC, WPS), ext extension (. EXE,. COM), and were deposited in the corresponding variables.
Int getcurdir (int drive, char * direc) This function to return to the designated driver for the current working directory name
Drive the designated driver (0 = At present, A = 1, B = 2, C = 3, etc.)
Direc preservation of the current work of the designated driver successful return path variable 0
Char * getcwd (char * buf, iint n) this function from the current working directory and credited buf, n word until
Length of the festival. Wrong return NULL
Int getdisk () from the ongoing use of the drive, return an integer (0 = A, B = 1, C = 2, etc.)
Int setdisk (int drive) to install drivers to use the drive (0 = A, B = 1, C = 2, etc.)
Back to the total number of drives can be used
Int mkdir (char * pathname) to establish a new directory pathname, the successful return 0
Int rmdir (char * pathname) to delete a directory pathname, the successful return 0
Char * mktemp (char * template) a current directory structure of the document were not side-by-side in the template
Char * searchpath (char * pathname) using MSDOS filename of the document to find the path
This function uses the DOS PATH variable, return NULL File not found
Process function of the library for stdlib.h, process.h
Void abort () function by calling this export code 3 _ exit information on the termination of a written stderr,
And abnormal termination procedures. There are no return values
Int exec… load and run other programs
Int execl (char * pathname, arg0 char *, char * arg1,…, char * argn, NULL)
Int execle (char * pathname, arg0 char *, char * arg1,…,
Char * argn, NULL, char * envp [])
Int execlp (char * pathname, arg0 char *, char * arg1,…, NULL)
Int execlpe (char * pathname, arg0 char *, char * arg1,…, NULL, char * envp [])
Int execv (pathname char *, char * argv [])
Int execve (pathname char *, char * argv [], char * envp [])
Int execvp (pathname char *, char * argv [])
Int execvpe (pathname char *, char * argv [], char * envp [])
Family exec function and operational procedures into pathname, and parameters
Arg0 (arg1, arg2, argv [], envp []) passed to the subroutine, and that mistakes return -1
Exec function in the tribe, the suffix l, v, p, e added to the exec,
Function specified in the operation will have a capacity of
A suffix p, the function can use the DOS PATH variable View subroutine document.
L, the transfer function was fixed number of parameters.
V, the transfer function is not a fixed number of parameters.
E, the transfer function parameters specified envp, allowed to change the process of the environment,
No e suffix, the process of using the current procedures environment.
Void _exit (int status) termination of the current process, but does not clean up the scene
Void exit (int status) termination of the current procedures, to close down all the documents, write buffer output (for output),
Call and register any "export function," no return value
Int spawn… running subroutine
Int spawnl (int mode, char * pathname, arg0 char *, char * arg1,…,
Char * argn, NULL)
Int spawnle (int mode, char * pathname, arg0 char *, char * arg1,…,
Char * argn, NULL, char * envp [])
Int spawnlp (int mode, char * pathname, arg0 char *, char * arg1,…,
Char * argn, NULL)
Int spawnlpe (int mode, char * pathname, arg0 char *, char * arg1,…,
Char * argn, NULL, char * envp [])
Int spawnv (int mode, pathname char *, char * argv [])
Int spawnve (int mode, pathname char *, char * argv [], char * envp [])
Int spawnvp (int mode, pathname char *, char * argv [])
Int spawnvpe (int mode, pathname char *, char * argv [], char * envp [])
Functions in the spawn mode operation mode subroutine pathname, and parameters
Arg0 (arg1, arg2, argv [], envp []) passed to the subroutine. Wrong return -1
Mode of operation mode
P_WAIT mode of operation that subroutine to return after the procedure
P_NOWAIT that subroutine at the same time running the operation procedures (not available)
P_OVERLAY that after this procedure from running subroutine
Spawn function in the tribe, the suffix l, v, p, e Add to spawn,
Function specified in the operation will have a capacity of
A suffix p, the function using DOS PATH View subroutine document
L, the transfer function of the number of fixed parameters.
V, the transfer function of the number of parameters is not fixed.
E, envp specified parameters can be passed to the subroutine, allowed to change subroutine operating environment.
When no e suffix, the subroutine use of this procedure environment.
Int system (char * command) will be passed on to MSDOS DOS command ordered the implementation of
Conversion subroutines, functions as math.h, stdlib.h, ctype.h, float.h
Char * ecvt (double value, int ndigit, int * decpt, int * sign)
Float value will be converted into a string and returns the string
Char * fcvt (double value, int ndigit, int * decpt, int * sign)
Float value will be converted into a string and returns the string
Char * gcvt (double value, int ndigit, char * buf)
Value will be converted into a string of side-by-side buf, and return to the buf pointer
Char * ultoa (unsigned long value, char * string, int radix)
There will be no symbol integer value into a string and returns the string, radix conversion to the base used by the
Char * ltoa (long value, char * string, int radix)
Long integer value will be converted into a string and returns the string, radix conversion to the base used by the
Char * itoa (int value, char * string, int radix)
Integer value will be converted into strings into string, radix conversion to the base used by the
Double atof (char * nptr) will be converted to dual string nptr few precision, and return to this number, the wrong return 0
Int atoi (char * nptr) will be converted into a string nptr integer and return to this number, the wrong return 0
Long atol (char * nptr) string nptr growth integer conversion, and return to this number, the wrong return 0
Double strtod (char * str, char ** endptr) will be converted to dual string str few precision, and return to this number,
Long strtol (char * str, char ** endptr, int base) string str growth integer conversion,
And return to this number,
Int toascii (int c) Return to the corresponding ASCII c
Int tolower (int ch) if ch is the capital letters ( 'A'-'Z') to return to the corresponding lowercase letters ( 'a'-'z')
Int _tolower (int ch) return ch corresponding lowercase letters ( 'a'-'z')
Int toupper (int ch) if ch is lowercase letters ( 'a'-'z') to return to the corresponding capital letters ( 'A'-'Z')
Int _toupper (int ch) return ch corresponding capital letters ( 'A'-'Z')
Diagnosis function, which functions as assert.h, math.h
Void assert (int test) as an extension if the statement as Acer, if the test failures,
Shows an abnormal termination of information and procedures, no return value
Void perror (char * string) function will display the last error message, the following form:
String string: wrong message
Char * strerror (char * str) function to return to the last error message, the following form:
String str: wrong message
Int matherr (struct exception * e)
Users modify mathematical error return information function (there is no need to use)
Double _matherr (_mexcep why, char * fun, double * arg1p,
* Arg2p double, double retval)
Users modify mathematical error return information function (there is no need to use)
Input and output subroutines, functions as io.h, conio.h, stat.h, dos.h, stdio.h, signal.h
Int kbhit () function to return to the recent strike by the button
Int fgetchar () from the console (keyboard) read a character that on the screen
Int getch () from the console (keyboard) read a character, not displayed on the screen
Int putch () to the console (keyboard) to write a character
Int getchar () from the console (keyboard) read a character that on the screen
Int putchar () to the console (keyboard) to write a character
Int getche () from the console (keyboard) read a character that on the screen
Int ungetch (int c) the characters c returned to the console (keyboard)
Char * cgets (char * string) from the console (keyboard) read in the string stored in string
Int scanf (char * format, [argument…]) from the console read a string, respectively, on the various parameters
Assignment, use a BIOS output
Int vscanf (char * format, Valist param) from the console read a string, respectively, on the various parameters
Assignment, use a BIOS output parameters obtained from Valist param
Int cscanf (char * format, [argument…]) from the console read a string, respectively, on the various parameters
Assignment, directly to the console for the operation, such as when the characters display in the show when it is displayed directly write frequency
Int sscanf (char * string, char * format [, argument,…]) string by string, respectively, on all
Parameter assignment
Int vsscanf (char * string, char * format, Vlist param) string string respectively all
Parameter assignment, the parameters obtained from Vlist param
Int puts (char * string), string string to the one console (displays),
Use a BIOS output
Void cputs (char * string) sent a string string to the console (displays),
Directly to the console for the operation, for example, which is directly write-frequency monitors display
Int printf (char * format [, argument,…]) format string output sent to the console (Monitor)
Use a BIOS output
Int vprintf (char * format, Valist param) format string output sent to the console (Monitor)
BIOS to use the output parameter obtained from Valist param
Int cprintf (char * format [, argument,…]) format string output sent to the console (displays),
Directly to the console for the operation, for example, which is directly write-frequency monitors display
Int vcprintf (char * format, Valist param) format string output sent to the console (displays),
Directly to the console for the operation, for example, which is directly write frequency display mode,
Parameters obtained from Valist param
Int sprintf (char * string, char * format [, argument,…])
String string will be re-written for the contents of the format string
Int vsprintf (char * string, char * format, Valist param)
String string will be re-written for the contents of the format string, parameters obtained from Valist param
Int rename (oldname char *, char * newname) will change the name of the paper oldname newname
Int ioctl (int handle, int cmd [* argdx int, int argcx])
This function is used to control input / output devices, as follows:
┌ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ cmd value │ function │
├ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┤
│ 0 │ removal equipment information │
│ │ set up an information equipment │
│ 2 │ argcx to read bytes from the address referred argdx │
│ 3 │ referred in the address to write argdx argcx bytes │
│ 4 │ except as a device to handle (0 = At present, 1 = A, etc.), and are the same cmd = 2:00 │
│ 5 │ except as a device to handle (0 = At present, 1 = A, etc.), and are the same cmd = 3:00 │
│ 6 │ input from the state │
│ │ 7 from the output state │
│ 8 │ for testing; only for DOS 3.x │
│ 11 │ conflict home to share the heavy calculations; only DOS 3.x │
└ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
Int (* ssignal (int sig, int (* action )())() software implementation of signal (no need to use)
Int gsignal (int sig) software implementation of signal (no need to use)
Int _open (pathname char *, int access) to read or write a file open,
By then click access to determine the document is read or written documents, access value shown in the table below
┌ ─ ─ ─ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ access value │ significance │
├ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┤
│ O_RDONLY │ read documents │
│ O_WRONLY │ written document │
│ O_RDWR │ also wrote that the Reading │
│ O_NOINHERIT │ if the documents are not passed to the subroutine, was included │
│ O_DENYALL │ only allows access to the documents which must │
│ O_DENYWRITE │ only allowed from any other open files Reading │
│ O_DENYREAD │ only allowed from any other open files written │
│ O_DENYNONE │ allow other shared files open to │
└ ─ ─ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
Int open (pathname char *, int access [int permiss]) to read or write a file open,
By then click access to determine the document is read or written documents, access value shown in the table below
┌ ─ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ access value │ significance │
├ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┤
│ O_RDONLY │ read documents │
│ O_WRONLY │ written document │
│ O_RDWR │ also wrote that the Reading │
│ O_NDELAY │ not use the UNIX system compatible │
│ O_APPEND │ that Reading has been written, but each time the document written in the tail always add │
│ O_CREAT │ if the documents exist, the logo useless; if it does not exist, building new documents │
│ O_TRUNC │ if the documents exist, the length was cut to zero, the same attributes │
│ O_EXCL │ unused; on the UNIX system compatible │
│ O_BINARY │ the logo can be displayed in binary form is given to open the file │
│ O_TEXT │ the logo can be used to display the text given way to open the file │
└ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
Permiss document attributes, the following values:
S_IWRITE allowed to write S_IREAD allow Reading S_IREAD | S_IWRITE allow reading and writing
Int creat (char * filename, int permiss) the establishment of a new document filename, and set
Of literacy. Permiss document literacy, for the following values
S_IWRITE allowed to write S_IREAD allow Reading S_IREAD | S_IWRITE allow reading and writing
Int _creat (char * filename, int attrib) the establishment of a new document filename, and configuration files
Attribute. Attrib document attributes, the following values
FA_RDONLY CD-FA_HIDDEN hidden FA_SYSTEM system
Int creatnew (filenamt char *, int attrib) the establishment of a new document filename, and configuration files
Attribute. Attrib document attributes, the following values
FA_RDONLY CD-FA_HIDDEN hidden FA_SYSTEM system
Int creattemp (filenamt char *, int attrib) the establishment of a new document filename, and configuration files
Attribute. Attrib document attributes, the following values
FA_RDONLY CD-FA_HIDDEN hidden FA_SYSTEM system
Int read (int handle, void * buf, int nbyte), to handle documents from the document read nbyte characters
Buf deposited in the
Int _read (int handle, void * buf, int nbyte), to handle documents from the document read nbyte characters
Into buf, direct call MSDOS to operate.
Int write (int handle, void * buf, int nbyte) buf nbyte characters in the written document,
To handle the paper
Int _write (int handle, void * buf, int nbyte) buf nbyte characters in the written document,
To handle the paper
Int dup (int handle) copy of a document processing pointer handle, return to this guideline
Int dup2 (int handle, int newhandle) copy of a document dealing with guidelines to handle newhandle
Int eof (int * handle) check file end, the end of a return, or else return 0
Long filelength (int handle) Return to document length, handle document,
Int setmode (int handle, unsigned mode) to set this function to handle the document, a document
Open manner
Int getftime (int handle, struct ftime * ftime) to handle its document reader of the document,
And documents stored in ftime time in the structure of the successful return of 0, ftime structured as follows:
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ struct ftime │
│ (│
│ unsigned ft_tsec: 5; / * second * / │
│ unsigned ft_min: 6; / *-* / │
│ unsigned ft_hour: 5; / * * / │
│ unsigned ft_day: 5; / * * / │
│ unsigned ft_month: 4; / *, * / │
│ unsigned ft_year: 1 / *, * -1980 / │
│) │
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
Int setftime (int handle, struct ftime * ftime) rewriting of the document, to handle documents,
Ftime new structure in time. Successful return 0. Ftime structure as follows:
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ struct ftime │
│ (│
│ unsigned ft_tsec: 5; / * second * / │
│ unsigned ft_min: 6; / *-* / │
│ unsigned ft_hour: 5; / * * / │
│ unsigned ft_day: 5; / * * / │
│ unsigned ft_month: 4; / *, * / │
│ unsigned ft_year: 1 / *, * -1980 / │
│) │
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
Long lseek (int handle, long offset, int fromwhere), this function will be to handle paper documents
Fromwhere after the pointer to the offset bytes Department.
SEEK_SET switch SEEK_CUR paper documents tail current location SEEK_END
Long tell (int handle) function to return to the document, a document of guidelines to handle, said in bytes
Int isatty (int handle) from the function to handle the type of equipment
Int lock (int handle, long offset, long length) on the file-sharing for blockade
Int unlock (int handle, long offset, long length) opened the blockade on file-sharing
Int close (int handle) expressed by the closure handle document processing, from the handle _ creat, creat,
Creatnew, creattemp, dup, dup2, _open, in an open access to the call document processing
Otherwise, the successful return of 0 to return -1, can be used for UNIX System
Int _close (int handle) expressed by the closure handle document processing, from the handle _ creat, creat,
Creatnew, creattemp, dup, dup2, _open, in an open access to the call document processing
Otherwise, the successful return of 0 to return -1, can only be used MSDOS system
FILE * fopen (char * filename, char * type) open a file filename, opens way for the type,
And return to this document indicators, type can be added for the following string suffix
┌ ─ ─ ┬ ─ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ type │ │ text of literacy / 2 hex document │ Jianxin / open old documents │
├ ─ ─ ┼ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ┤
│ r │ Reading │ text │ open the old document │
│ w │ │ write text documents │ │ Jianxin
│ a │ add text │ │ there is no opening on the New │
│ r + │ read / write │ not limited │ open │
│ w + │ read / write │ not limited │ Jianxin document │
│ a + │ read / add │ no restrictions on open │ there is no Jianxin │
└ ─ ─ ┴ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ┘
Suffixes can be added to t, b. And b indicates that the document in binary form of operation, there was no need to use t
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) from the flow stream read a character, and return to the characters
Int putc (int ch, FILE * stream) to the flow stream into a character ch
Int getw (FILE * stream) from the flow stream read an integer, the wrong return EOF
Int putw (int w, FILE * stream) to the flow stream into an integer
Int ungetc (char c, FILE * stream) characters c returned to the stream flow, the next one will be read into the characters is c
Int fgetc (FILE * stream) from the flow stream read a character, and return to the characters
Int fputc (int ch, FILE * stream) characters in the stream flow into ch
Char * fgets (char * string, int n, FILE * stream) read from the flow stream into n characters in the string
Int fputs (char * string, FILE * stream) strings in the string into the flow stream
Int fread (void * ptr, int size, int nitems, FILE * stream) read from the flow stream into nitems
A length of string for the size of the deposit ptr
Int fwrite (void * ptr, int size, int nitems, FILE * stream) in the stream to flow into the nitems
A length of the string size, in the string of ptr
Int fscanf (FILE * stream, char * format [, argument,…]) formatted in the form of stream flow
Read a string
Int vfscanf (FILE * stream, char * format, Valist param) format in the form of stream flow
Read a string, parameters obtained from Valist param
Int fprintf (FILE * stream, char * format [, argument,…]) to form a character formatting
String wrote designated stream flow
Int vfprintf (FILE * stream, char * format, Valist param) to form a character formatting
Series flow stream addressed to the designated parameters obtained from Valist param
Int fseek (FILE * stream, long offset, int fromwhere) function pointer to the document fromwhere
Referred to the location of backward offset bytes, fromwhere value for the following:
SEEK_SET switch SEEK_CUR paper documents tail current location SEEK_END
Long ftell (FILE * stream) returned to the position in the stream function in the current pointer position paper, expressed in bytes
Int rewind (FILE * stream) to the current file pointer stream moved to the beginning of the document
Int feof (FILE * stream) of the flow stream at the end of the guideline document position
Int fileno (FILE * stream) on the stream flow from document processing, document processing and return to
Int ferror (FILE * stream), detect whether there is a flow stream read and write errors, mistakes will return 1 if
Void clearerr (FILE * stream) on the removal of the flow stream read and write errors
Void setbuf (FILE * stream, char * buf) to designate a flow stream buffer buf
Void setvbuf (FILE * stream, char * buf, int type, unsigned size)
To designate a flow stream buffer buf, size for size, type of type, type values shown in the table below
┌ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ type of significance │ │
├ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┤
│ _ IOFBF │ document is entirely the buffer zone, when the buffer is empty, the next entry operation will be an attempt to fill the entire relief │
│ │ Chong district. Exporting, wrote in the document before any data, the buffer zone will be completely filled. │
│ _ IOLBF │ documents to the buffer zone. When the buffer is empty, the next entry operation will continue to attempt to fill the entire relief │
│ │ Chong district. In output, however, whenever a new line at the paper wrote, the buffer zone was Qingxiandiao. │
│ _ IONBF │ document is no buffer. Buf and size parameters are neglected. Each input will be operated directly from the text │
│ │ of Reading, will operate each output data immediately wrote in the document. │
└ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
Int fclose (FILE * stream) closed a flow, it could be documents or equipment (such as LPT1)
Int fcloseall () or close down all except stdin, stdout stream
Int fflush (FILE * stream) closed a flow, and the buffer zone to deal with
Reading that the deal with the flow, the flow of content will be read into the buffer;
The flow of writing, the contents of the buffer zone into the flow. The successful return 0
Int fflushall () to close down all flow, and flow of the buffer zone to deal with their own
Reading that the deal with the flow, the flow of content will be read into the buffer;
The flow of writing, the contents of the buffer zone into the flow. The successful return 0
Int access (char * filename, int amode) function checks the document filename of the document and return to nature,
Attribute function will be stored in amode, amode from a combination of the following -
06 can read, write 04 can be read 02 can be written 01 implementation (neglected) 00 files
If the filename is a directory, directory function will only determine whether there
Executive function of the successful return of 0, or -1 to return
Int chmod (char * filename, int permiss) function to set the filename of the file attributes
Permiss value for the following
S_IWRITE allowed to write S_IREAD allow Reading S_IREAD | S_IWRITE allow reading and writing
Int _chmod (char * filename, int func [int attrib]);
This function used to read or set the attribute document filename,
When func = 0, the function returns the properties of documents when func = 1, the function of the attribute settings files
If the configuration file attributes, and can be attrib one of the following constants
FA_RDONLY CD-FA_HIDDEN hidden FA_SYSTEM system
Interface subroutine, which functions as follows: dos.h, bios.h
Unsigned sleep (unsigned seconds) suspended seconds microsecond (1 per cent seconds)
Int unlink (char * filename) delete the file filename
Unsigned FP_OFF (void far * farptr) to the function pointer farptr far from the offset
Unsigned FP_SEG (void far * farptr) to the function pointer farptr not far from the home of value
MK_FP void far * (unsigned seg, unsigned off) and the offset of the seg construct a far off target
Unsigned getpsp () the procedures of the prefix of the address, and return to this address
Char * parsfnm (char * cmdline, struct fcb fcbptr *, int option)
Function Analysis of a string, usually for a file name, it is referred to by cmdline a command line.
Add a file name is FCB as a driver, the file name and extension. FCB referred to by the fcbptr
Set. Option parameter analysis system called DOS, AL text value.
Int absread (int drive, int nsects, int sectno, void * buffer) the function of specific functions for Reading
Disk sector, the drive for drive (0 = A, 1 = B, etc.) in order to read nsects number of sectors, for the beginning of logic sectno
Repertoire sector of the buffer to preserve the preservation of reading data space
Int abswrite (int drive, int nsects, int sectno, void * buffer) the function of specific functions for writing
Disk sector, the drive for drive (0 = A, 1 = B, etc.), nsects the number of sectors for the post, for the beginning of logic sectno
Repertoire sector, buffer written for the preservation of data space
Void getdfree (int drive, struct dfree * dfreep) from the function to the free disk space,
drive为磁盘号(0=当前,1=A等).函数将磁盘特性的由dfreep指向的dfree结构中.
dfree结构如下:
┌───────────────────┐
│struct dfree │
│{ │
│ unsigned df_avail; /*有用簇个数*/ │
│ unsigned df_total; /*总共簇个数*/ │
│ unsigned df_bsec; /*每个扇区字节数*/│
│ unsigned df_sclus; /*每个簇扇区数*/ │
│} │
└───────────────────┘
char far *getdta() 取磁盘转换地址DTA
void setdta(char far *dta)设置磁盘转换地址DTA
void getfat(int drive,fatinfo *fatblkp)
本函数返回指定驱动器drive(0=当前,1=A,2=B等)的文件分配表信息
并存入结构fatblkp中,结构如下:
┌──────────────────┐
│struct fatinfo │
│{ │
│ char fi_sclus; /*每个簇扇区数*/ │
│ char fi_fatid; /*文件分配表字节数*/│
│ int fi_nclus; /*簇的数目*/ │
│ int fi_bysec; /*每个扇区字节数*/ │
│} │
└──────────────────┘
void getfatd(struct fatinfo *fatblkp) 本函数返回当前驱动器的文件分配表信息,
并存入结构fatblkp中,结构如下:
┌──────────────────┐
│struct fatinfo │
│{ │
│ char fi_sclus; /*每个簇扇区数*/ │
│ char fi_fatid; /*文件分配表字节数*/│
│ int fi_nclus; /*簇的数目*/ │
│ int fi_bysec; /*每个扇区字节数*/ │
│} │
└──────────────────┘
int bdos(int dosfun,unsigned dosdx,unsigned dosal)本函数对MSDOS系统进行调用,
dosdx为寄存器dx的值,dosal为寄存器al的值,dosfun为功能号
int bdosptr(int dosfun,void *argument,unsiigned dosal)本函数对MSDOS系统进行调用,
argument为寄存器dx的值,dosal为寄存器al的值,dosfun为功能号
int int86(int intr_num,union REGS *inregs,union REGS *outregs)
执行intr_num号中断,用户定义的寄存器值存于结构inregs中,
执行完后将返回的寄存器值存于结构outregs中.
int int86x(int intr_num,union REGS *inregs,union REG, S *o, utregs,
struct SREGS *segregs)执行intr_num号中断,用户定义的寄存器值存于
结构inregs中和结构segregs中,执行完后将返回的寄存器值存于结构outregs中.
int intdos(union REGS *inregs,union REGS *outregs)
本函数执行DOS中断0x21来调用一个指定的DOS函数,用户定义的寄存器值
存于结构inregs中,执行完后函数将返回的寄存器值存于结构outregs中
int intdosx(union REGS *inregs,union REGS *outregs,struct SREGS *segregs)
本函数执行DOS中断0x21来调用一个指定的DOS函数,用户定义的寄存器值
存于结构inregs和segregs中,执行完后函数将返回的寄存器值存于结构outregs中
void intr(int intr_num,struct REGPACK *preg)本函数中一个备用的8086软件中断接口
它能产生一个由参数intr_num指定的8086软件中断.函数在执行软件中断前,
从结构preg复制用户定义的各寄存器值到各个寄存器.软件中断完成后,
函数将当前各个寄存器的值复制到结构preg中.参数如下:
intr_num 被执行的中断号
preg为保存用户定义的寄存器值的结构,结构如下
┌──────────────────────┐
│struct REGPACK │
│{ │
│ unsigned r_ax,r_bx,r_cx,r_dx; │
│ unsigned r_bp,r_si,r_di,r_ds,r_es,r_flags; │
│} │
└──────────────────────┘
函数执行完后,将新的寄存器值存于结构preg中
void keep(int status,int size)以status状态返回MSDOS,但程序仍保留于内存中,所占
用空间由size决定.
void ctrlbrk(int (*fptr)()) 设置中断后的对中断的处理程序.
void disable() 禁止发生中断
void enable() 允许发生中断
void geninterrupt(int intr_num)执行由intr_num所指定的软件中断
void interrupt(* getvect(int intr_num))() 返回中断号为intr_num的中断处理程序,
例如: old_int_10h=getvect(0x10);
void setvect(int intr_num,void interrupt(* isr)()) 设置中断号为intr_num的中
断处理程序为isr,例如: setvect(0x10,new_int_10h);
void harderr(int (*fptr)()) 定义一个硬件错误处理程序,
每当出现错误时就调用fptr所指的程序
void hardresume(int rescode)硬件错误处理函数
void hardretn(int errcode) 硬件错误处理函数
int inport(int prot) 从指定的输入端口读入一个字,并返回这个字
int inportb(int port)从指定的输入端口读入一个字节,并返回这个字节
void outport(int port,int word) 将字word写入指定的输出端口port
void outportb(int port,char byte)将字节byte写入指定的输出端口port
int peek(int segment,unsigned offset) 函数返回segment:offset处的一个字
char peekb(int segment,unsigned offset)函数返回segment:offset处的一个字节
void poke(int segment,int offset,char value) 将字value写到segment:offset处
void pokeb(int segment,int offset,int value) 将字节value写到segment:offset处
int randbrd(struct fcb *fcbptr,int reccnt)
函数利用打开fcbptr所指的FCB读reccnt个记录.
int randbwr(struct fcb *fcbptr,int reccnt)
函数将fcbptr所指的FCB中的reccnt个记录写到磁盘上
void segread(struct SREGS *segtbl)函数把段寄存器的当前值放进结构segtbl中
int getverify() 取检验标志的当前状态(0=检验关闭,1=检验打开)
void setverify(int value)设置当前检验状态,
value为0表示关闭检验,为1表示打开检验
int getcbrk()本函数返回控制中断检测的当前设置
int setcbrk(int value)本函数用来设置控制中断检测为接通或断开
当value=0时,为断开检测.当value=1时,为接开检测
int dosexterr(struct DOSERR *eblkp)取扩展错误.在DOS出现错误后,此函数将扩充的
错误信息填入eblkp所指的DOSERR结构中.该结构定义如下:
┌──────────────┐
│struct DOSERR │
│{ │
│ int exterror;/*扩展错误*/ │
│ char class; /*错误类型*/ │
│ char action; /*方式*/ │
│ char locus; /*错误场所*/ │
│} │
└──────────────┘
int bioscom(int cmd,char type,int port) 本函数负责对数据的通讯工作,
cmd可以为以下值:
0 置通讯参数为字节byte值1 发送字符通过通讯线输出
2 从通讯线接受字符3 返回通讯的当前状态
port为通讯端口,port=0时通讯端口为COM1,port=1时通讯端口为COM2,以此类推
byte为传送或接收数据时的参数,为以下位的组合:
┌───┬─────┬───┬─────┬───┬─────┐
│byte值│意义│byte值│意义│byte值│意义│ │
├───┼─────┼───┼─────┼───┼─────┤
│0x02 │7数据位│0x03 │8数据位│0x00 │1停止位│ │
│0x04 │2停止位│0x00 │无奇偶性│0x08 │奇数奇偶性│ │
│0x18 │偶数奇偶性│0x00 │110波特│0x20 │150波特│ │
│0x40 │300波特│0x60 │600波特│0x80 │1200波特│ │
│0xA0 │2400波特│0xC0 │4800波特│0xE0 │9600波特│ │
└───┴─────┴───┴─────┴───┴─────┘
例如:0xE0|0x08|0x00|0x03即表示置通讯口为9600波特,奇数奇偶性,1停止位,
8数据位.
函数返回值为一个16位整数,定义如下:
第15位 超时
第14位 传送移位寄存器空
第13位 传送固定寄存器空
第12位 中断检测
第11位 帧错误
第10位 奇偶错误
第 9位 过载运行错误
第 8位 数据就绪
第 7位 接收线信号检测
第 6位 环形指示器
第 5位 数据设置就绪
第 4位 清除发送
第 3位 δ接收线信号检测器
第 2位 下降边环形检测器
第 1位 δ数据设置就绪
第 0位 δ清除发送
int biosdisk(int cmd,int drive,int head,int track,
int sector,int nsects,void *buffer)
本函数用来对驱动器作一定的操作,cmd为功能号,
drive为驱动器号(0=A,1=B,0x80=C,0x81=D,0x82=E等).cmd可为以下值:
0 重置软磁盘系统.这强迫驱动器控制器来执行硬复位.忽略所有其它参数.
1 返回最后的硬盘操作状态.忽略所有其它参数
2 读一个或多个磁盘扇区到内存.读开始的扇区由head、track、sector给出。
扇区号由nsects给出。把每个扇区512个字节的数据读入buffer
3 从内存读数据写到一个或多个扇区。写开始的扇区由head、track、sector
给出。扇区号由nsects给出。所写数据在buffer中,每扇区512个字节。
4 检验一个或多个扇区。开始扇区由head、track、sector给出。扇区号由
nsects给出。
5 格式化一个磁道,该磁道由head和track给出。 buffer指向写在指定track上
的扇区磁头器的一个表。
以下cmd值只允许用于XT或AT微机:
6 格式化一个磁道,并置坏扇区标志。
7 格式化指定磁道上的驱动器开头。
8 返回当前驱动器参数,驱动器信息返回写在buffer中(以四个字节表示)。
9 初始化一对驱动器特性。
10 执行一个长的读,每个扇区读512加4个额外字节
11 执行一个长的写,每个扇区写512加4个额外字节
12 执行一个磁盘查找
13 交替磁盘复位
14 读扇区缓冲区
15 写扇区缓冲区
16 检查指定的驱动器是否就绪
17 复核驱动器
18 控制器RAM诊断
19 驱动器诊断
20 控制器内部诊
函数返回由下列位组合成的状态字节:
0x00 操作成功
0x01 坏的命令
0x02 地址标记找不到
0x04 记录找不到
0x05 重置失败
0x07 驱动参数活动失败
0x09 企图DMA经过64K界限
0x0B 检查坏的磁盘标记
0x10 坏的ECC在磁盘上读
0x11 ECC校正的数据错误(注意它不是错误)
0x20 控制器失效
0x40 查找失败
0x80 响应的连接失败
0xBB 出现无定义错误
0xFF 读出操作失败
int biodquip() 检查设备,函数返回一字节,该字节每一位表示一个信息,如下:
第15位 打印机号
第14位 打印机号
第13位 未使用
第12位 连接游戏I/O
第11位 RS232端口号
第 8位 未使用
第 7位 软磁盘号
第 6位 软磁盘号,
00为1号驱动器,01为2号驱动器,10为3号驱动器,11为4号驱动器
第 5位 初始化
第 4位 显示器模式
00为未使用,01为40x25BW彩色显示卡
10为80x25BW彩色显示卡,11为80x25BW单色显示卡
第 3位 母扦件
第2位随机存贮器容量,00为16K,01为32K,10为48K,11为64K
第 1位 浮点共用处理器
第 0位 从软磁盘引导
int bioskey(int cmd)本函数用来执行各种键盘操作,由cmd确定操作。
cmd可为以下值:
0 返回敲键盘上的下一个键。若低8位为非0,即为ASCII字符;若低8位为0,
则返回扩充了的键盘代码。
1 测试键盘是否可用于读。返回0表示没有键可用;否则返回下一次敲键之值。
敲键本身一直保持由下次调用具的cmd值为0的bioskey所返回的值。
2 返回当前的键盘状态,由返回整数的每一个位表示,见下表:
┌──┬───────────┬───────────┐
│ 位│为0时意义│为1时意义│
├──┼───────────┼───────────┤
│ 7 │插入状态│改写状态│
│ 6 │大写状态│小写状态│
│ 5 │数字状态,NumLock灯亮│光标状态,NumLock灯熄│
│ 4 │ScrollLock灯亮│ScrollLock灯熄│
│ 3 │Alt按下│Alt未按下│
│ 2 │Ctrl按下│Ctrl未按下│
│ 1 │左Shift按下│左Shift未按下│
│ 0 │右Shift按下│右Shift未按下│
└──┴───────────┴───────────┘
int biosmemory()返回内存大小,以K为单位.
int biosprint(int cmd,int byte,int port)控制打印机的输入/输出.
port为打印机号,0为LPT1,1为LPT2,2为LPT3等
cmd可以为以下值:
0 打印字符,将字符byte送到打印机
1 打印机端口初始化
2 读打印机状态
函数返回值由以下位值组成表示当前打印机状态
0x01 设备时间超时
0x08 输入/输出错误
0x10 选择的
0x20 走纸
0x40 认可
0x80 不忙碌
int biostime(int cmd,long newtime)计时器控制,cmd为功能号,可为以下值
0 函数返回计时器的当前值
1 将计时器设为新值newtime
struct country *country(int countrycmode,struct country *countryp)
本函数用来控制某一国家的相关信息,如日期,时间,货币等.
若countryp=-1时,当前的国家置为countrycode值(必须为非0).否则,由countryp
所指向的country结构用下列的国家相关信息填充:
(1)当前的国家(若countrycode为0或2)由countrycode所给定的国家.
结构country定义如下:
┌────────────────────┐
│struct country │
│{ │
│ int co_date; /*日期格式*/ │
│ char co_curr[5]; /*货币符号*/ │
│ char co_thsep[2]; /*数字分隔符*/ │
│ char co_desep[2]; /*小数点*/ │
│ char co_dtsep[2]; /*日期分隔符*/ │
│ char co_tmsep[2]; /*时间分隔符*/ │
│ char co_currstyle; /*货币形式*/ │
│ char co_digits; /*有效数字*/ │
│ int (far *co_case)(); /*事件处理函数*/ │
│ char co_dasep; /*数据分隔符*/ │
│ char co_fill[10]; /*补充字符*/ │
│} │
└────────────────────┘
co_date的值所代表的日期格式是:
0 月日年 1 日月年 2 年月日
co_currstrle的值所代表的货币显示方式是
0 货币符号在数值前,中间无空格
1 货币符号在数值后,中间无空格
2 货币符号在数值前,中间有空格
3 货币符号在数值后,中间有空格
操作函数,所在函数库为string.h、mem.h
mem…操作存贮数组
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)
这些函数,mem…系列的所有成员均操作存贮数组.在所有这些函数中,数组是n字节长.
memcpy从source复制一个n字节的块到destin.如果源块和目标块重迭,则选择复制方向,
以例正确地复制覆盖的字节.
memmove与memcpy相同.
memset将s的所有字节置于字节ch中.s数组的长度由n给出.
memcmp比较正好是n字节长的两个字符串s1和s2.些函数按无符号字符比较字节,因此,
memcmp("0xFF","\x7F",1)返回值大于0.
memicmp比较s1和s2的前n个字节,不管字符大写或小写.
memccpy从source复制字节到destin.复制一结束就发生下列任一情况:
(1)字符ch首选复制到destin.
(2)n个字节已复制到destin.
memchr对字符ch检索s数组的前n个字节.
返回值:memmove和memcpy返回destin
memset返回s的值
memcmp和memicmp─┬─若s1 ├─若s1=s2返回值等于0
└─若s1>s2返回值大于0
memccpy若复制了ch,则返回直接跟随ch的在destin中的字节的一个指针;
否则返回NULL
memchr返回在s中首先出现ch的一个指针;如果在s数组中不出现ch,就返回NULL.
void movedata(int segsrc,int offsrc,
int segdest,int offdest,
unsigned numbytes)
本函数将源地址(segsrc:offsrc)处的numbytes个字节
复制到目标地址(segdest:offdest)
void movemem(void *source,void *destin,unsigned len)
本函数从source处复制一块长len字节的数据到destin.若源地址和目标地址字符串
重迭,则选择复制方向,以便正确的复制数据.
void setmem(void *addr,int len,char value)
本函数把addr所指的块的第一个字节置于字节value中.
str…字符串操作函数
char stpcpy(char *dest,const char *src)
将字符串src复制到dest
char strcat(char *dest,const char *src)
将字符串src添加到dest末尾
char strchr(const char *s,int c)
检索并返回字符c在字符串s中第一次出现的位置
int strcmp(const char *s1,const char *s2)
比较字符串s1与s2的大小,并返回s1-s2
char strcpy(char *dest,const char *src)
将字符串src复制到dest
size_t strcspn(const char *s1,const char *s2)
扫描s1,返回在s1中有,在s2中也有的字符个数
char strdup(const char *s)
将字符串s复制到最近建立的单元
int stricmp(const char *s1,const char *s2)
比较字符串s1和s2,并返回s1-s2
size_t strlen(const char *s)
返回字符串s的长度
char strlwr(char *s)
将字符串s中的大写字母全部转换成小写字母,并返回转换后的字符串
char strncat(char *dest,const char *src,size_t maxlen)
将字符串src中最多maxlen个字符复制到字符串dest中
int strncmp(const char *s1,const char *s2,size_t maxlen)
比较字符串s1与s2中的前maxlen个字符
char strncpy(char *dest,const char *src,size_t maxlen)
复制src中的前maxlen个字符到dest中
int strnicmp(const char *s1,const char *s2,size_t maxlen)
比较字符串s1与s2中的前maxlen个字符
char strnset(char *s,int ch,size_t n)
将字符串s的前n个字符置于ch中
char strpbrk(const char *s1,const char *s2)
扫描字符串s1,并返回在s1和s2中均有的字符个数
char strrchr(const char *s,int c)
扫描最后出现一个给定字符c的一个字符串s
char strrev(char *s)
将字符串s中的字符全部颠倒顺序重新排列,并返回排列后的字符串
char strset(char *s,int ch)
将一个字符串s中的所有字符置于一个给定的字符ch
size_t strspn(const char *s1,const char *s2)
扫描字符串s1,并返回在s1和s2中均有的字符个数
char strstr(const char *s1,const char *s2)
扫描字符串s2,并返回第一次出现s1的位置
char strtok(char *s1,const char *s2)
检索字符串s1,该字符串s1是由字符串s2中定义的定界符所分隔
char strupr(char *s)
将字符串s中的小写字母全部转换成大写字母,并返回转换后的字符串
存贮分配子程序,所在函数库为dos.h、alloc.h、malloc.h、stdlib.h、process.h
int allocmem(unsigned size,unsigned *seg)利用DOS分配空闲的内存,
size为分配内存大小,seg为分配后的内存指针
int freemem(unsigned seg)释放先前由allocmem分配的内存,seg为指定的内存指针
int setblock(int seg,int newsize)本函数用来修改所分配的内存长度,
seg为已分配内存的内存指针,newsize为新的长度
int brk(void *endds)
本函数用来改变分配给调用程序的数据段的空间数量,新的空间结束地址为endds
char *sbrk(int incr)
本函数用来增加分配给调用程序的数据段的空间数量,增加incr个字节的空间
unsigned long coreleft() 本函数返回未用的存储区的长度,以字节为单位
void *calloc(unsigned nelem,unsigned elsize)分配nelem个长度为elsize的内存空间
并返回所分配内存的指针
void *malloc(unsigned size)分配size个字节的内存空间,并返回所分配内存的指针
void free(void *ptr)释放先前所分配的内存,所要释放的内存的指针为ptr
void *realloc(void *ptr,unsigned newsize)改变已分配内存的大小,ptr为已分配有内
存区域的指针,newsize为新的长度,返回分配好的内存指针.
long farcoreleft() 本函数返回远堆中未用的存储区的长度,以字节为单位
void far *farcalloc(unsigned long units,unsigned long unitsz)
从远堆分配units个长度为unitsz的内存空间,并返回所分配内存的指针
void *farmalloc(unsigned long size)分配size个字节的内存空间,
并返回分配的内存指针
void farfree(void far *block)释放先前从远堆分配的内存空间,
所要释放的远堆内存的指针为block
void far *farrealloc(void far *block,unsigned long newsize)改变已分配的远堆内
存的大小,block为已分配有内存区域的指针,newzie为新的长度,返回分配好
的内存指针
时间日期函数,函数库为time.h、dos.h
在时间日期函数里,主要用到的结构有以下几个:
总时间日期贮存结构tm
┌──────────────────────┐
│struct tm │
│{ │
│ int tm_sec; /*秒,0-59*/ │
│ int tm_min; /*分,0-59*/ │
│ int tm_hour; /*时,0-23*/ │
│ int tm_mday; /*天数,1-31*/ │
│ int tm_mon; /*月数,0-11*/ │
│ int tm_year; /*自1900的年数*/ │
│ int tm_wday; /*自星期日的天数0-6*/ │
│ int tm_yday; /*自1月1日起的天数,0-365*/ │
│ int tm_isdst; /*是否采用夏时制,采用为正数*/│
│} │
└──────────────────────┘
日期贮存结构date
┌───────────────┐
│struct date │
│{ │
│ int da_year; /*自1900的年数*/│
│ char da_day; /*天数*/ │
│ char da_mon; /*月数 1=Jan*/ │
│} │
└───────────────┘
时间贮存结构time
┌────────────────┐
│struct time │
│{ │
│ unsigned char ti_min; /*分钟*/│
│ unsigned char ti_hour; /*小时*/│
│ unsigned char ti_hund; │
│ unsigned char ti_sec; /*秒*/ │
│ │
└────────────────┘
char *ctime(long *clock)
本函数把clock所指的时间(如由函数time返回的时间)转换成下列格式的
字符串:Mon Nov 21 11:31:54 1983\n\0
char *asctime(struct tm *tm)
本函数把指定的tm结构类的时间转换成下列格式的字符串:
Mon Nov 21 11:31:54 1983\n\0
double difftime(time_t time2,time_t time1)
计算结构time2和time1之间的时间差距(以秒为单位)
struct tm *gmtime(long *clock)本函数把clock所指的时间(如由函数time返回的时间)
转换成格林威治时间,并以tm结构形式返回
struct tm *localtime(long *clock)本函数把clock所指的时间(如函数time返回的时间)
转换成当地标准时间,并以tm结构形式返回
void tzset()本函数提供了对UNIX操作系统的兼容性
long dostounix(struct date *dateptr,struct time *timeptr)
本函数将dateptr所指的日期,timeptr所指的时间转换成UNIX格式,并返回
自格林威治时间1970年1月1日凌晨起到现在的秒数
void unixtodos(long utime,struct date *dateptr,struct time *timeptr)
本函数将自格林威治时间1970年1月1日凌晨起到现在的秒数utime转换成
DOS格式并保存于用户所指的结构dateptr和timeptr中
void getdate(struct date *dateblk)本函数将计算机内的日期写入结构dateblk
中以供用户使用
void setdate(struct date *dateblk)本函数将计算机内的日期改成
由结构dateblk所指定的日期
void gettime(struct time *timep)本函数将计算机内的时间写入结构timep中,
以供用户使用
void settime(struct time *timep)本函数将计算机内的时间改为
由结构timep所指的时间
long time(long *tloc)本函数给出自格林威治时间1970年1月1日凌晨至现在所经
过的秒数,并将该值存于tloc所指的单元中.
int stime(long *tp)本函数将tp所指的时间(例如由time所返回的时间)
写入计算机中.
|