Turbo C 2.0 function Chinese description Daquan

xiaoxiao2021-03-06  66

TURBO C 2.0 function Chinese description Daquan ===============================

The classification function, the function library is CTYPE.H INT ISALPHA (INT CH) if CH is the letter ('A' - 'Z', 'A' - 'Z') Returns a non-0 value, otherwise returns 0 ISALNUM (INTC If CH is the letter ('A' - 'Z', 'A' - 'Z') or numbers ('0' - '9'), return non-0 value, otherwise returns 0 int ISASCII (INT CH) if Ch Is a character (0-127 in the ASCII code) Returns a non-0 value, otherwise it returns 0 int ISCNTRL (INT CH) If the CH is a waste character (0x7f) or normal control character (0x00-0x1f), return non-0 value, otherwise returns 0 INT isdigit (int CH) If the CH is a number ('0' - '9') returns a non-0 value, otherwise returns 0 int ipegraph (int CH) if CH is a printable character (excluding space) (0x21-0x7e) Returns a non-0 value, otherwise it returns 0 ISLOWER (INT CH) if the ch is lowercase letters ('A' - 'Z') returns a non-0 value, otherwise returns 0 int isprint (int CH) if CH is printable characters (including Space) (0x20-0x7e) Returns a non-0 value, otherwise returns 0 int IPUNCT (INT CH) Returns a non-0 value if the CH is the punctuation character (0x00-0x1f), otherwise returns 0 int ISSPACE (INT CH) if ch is a space ( ''), Horizontal tabs ('/ t'), Enter ('/ R'), Paper Wavel ('/ f'), Vertical Table ('/ V'), Repair (' / n '), return a non-0 value, otherwise returning 0 int isupper (int CH) If the CH is uppercase letters (' a '-' z ') returns a non-0 value, otherwise returning 0 int isxdigit (int CH) if ch is 16 Enter ('0' - '9', 'A' - 'F', 'A' - 'F') Returns Non 0 Values, otherwise returns 0 int TOLOWER (INT CH) if ch is uppercase letter (' A '-' Z ') Returns the corresponding lowercase letters (' A '-' Z ') Int Toupper (INT CH) If CH is lowercase letters (' A '-' Z ') returns the corresponding uppercase letter (' A ' -'Z')

Mathematical functions, the function library is Math.h, stdlib.h, string.h, float.h int ABS (INT i) Returns the absolute value Double Cabs of the entire parameter i Double Cabs (Struct Complex Znum) Returns the absolute value of the recoverable znum Fabs (double x) Returns the absolute value of the double precision parameter x Returns the absolute value Double Exp (Double X) of the long integer parameter N Returns Double Frexp (Double Value, Int * EPTR) Returns the value of x in value = x * 2n, n Store Double LDEXP (Double Value, INT Exp) in EPTR; Returns Value * 2EXP Double Log (Double X) Returns Double Log10 (Double X) Returns LOG10X Double Pow (Double X, Double Y) Returns the value of XY Double Pow10 (INT P) Returns 10p Double SQRT (Double X) Returns the X Return Double ACOS (Double X) Returns X's anti-rest COS- 1 (x) value, X is the arc Double Asin Returns the X-1 (X) value of the X, X is the arc Double ATAN (Double X) Returns an anti-fixed TAN-1 (X) value of X, X is an arc Double ATAN2 (Double Y, Double X) Returns Y / X of the UF Tan-1 (X) value, Y X is the curve COS (X) value of the x-race Double Cos (Double X), X is Arc Double SIN (Double X) Returns the sinusoidal SIN (X) value of the X, X is the orthosis TAN (X) value returns X of X, X is the two songs that returns the arc Double Cosh (Double X). The cosine COSH (X) value, X is a dual sine SINH (X) value returns X of the radians Double SINH (Double X), and X is a double-diced Tanh (X) value returns x-x, X) value, X) value, X. For the arc 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 the minimum integer floor (double x) of the NOD (Double X) Returns the maximum integer void Srand (unsigned seed) initialization random number generator INT RAND () generates a random number and returns this number Double Poly (Double X, INT N, Double C []) generates a multi-term Double MODF (Double Value, Double * IPTR) from the parameter to decompose the double-precision value value to the mantissa and Double Fmod (double x, double y) Return to X The remainder of / y Double Frexp (Double Value, INT * EPTR) divides the double-precision value VALUE into the mantissa and the order Double ATOF (Char * NPTR) converts the string NPTR into floating point number and returns this floating point number Double Atoi (char * nptr) Converting the string NPTR into an integer and returns this integer Double Atol (Char * NPTR) to convert the string NPTR to the integer and return this integer char * ECVT (Double Value, int NDIGIT, INT * DECPT, INT * SIGN) to float Value converts the string and returns the string char * FCVT (Double Value, Int NDIGIT, INT * DECPT, INT * SIGN) converts floating-point value value into a string and returns the string char * GCVT (Double Value, int NDIGIT CHAR * BUF) converts the number value into a string and returned to the buf pointer char * ULTOA (unsigned long value, char * string, int RADIX) converts unsigned integer values ​​into a string and returns This string, RADIX is converted to the conversion CHAR * LTOA (Long Value, CHAR * STRING, INT RADIX) converts long-intensive value VALUE into a string and returns the string, and Radix is ​​based on the base char * ITOA ( INT Value, Char * String, Int Radix converts the integer value into a string to store String, Radix is ​​the base Double Atof (Char * nptr) using the base Double ATOF (Char * nptr) when converting PTR conversion into a double-precision number, return this number, error Returns 0 int atoi (char * nptr) Converting the string nptr into an integer number, return this number, error Returns 0 long atol (char * nptr) will string NPTR conversion to the total number, and return this number, the error returns 0 Double StRTOD (Char * Str, Char ** Endptr) converts the string STR into double precision, returns this number, Long Strtol (Char * Str, Char ** endptr, int base converts the string STR conversion to the total number, returns this number, int match (Struct Exception * e) user modifies mathematical error return information function (no need to use) Double _Matherr (_Mexcep why, char * Fun, Double * Arg1p, Double * Arg2P, Double Retval) User Modify Mathematical Error Return Information Functions (Nothing Use) Unsigned INT_CLEAR87 () Clears floating point status words and returns the original floating point status void _fpreset () Reproduction Floating point mathematics package unsigned int _Status87 () Returns floating point status word

Catalog functions, where the library is dir.h, dos.h int chdir (char * path) the specified directory path (such as: "C: // WPS") becomes the current working directory, the successful return 0 int findfirst ( Char * pathname, struct ffblk * ffblk, int attrib, find the specified file, successfully returns 0 pathName as the specified directory name and file name, such as "c: // wps // txt" FFBLK is a structure for the specified save file information The definition is as follows: ┏┏━━━━━━━━━━━━━━━━┓┓┓┓┓━━━━━━┓┓ ┓Struct Ffblk ┓ ┓ h {cer ff_reserved [21]; / * DOS reserved word * / char ff_attrib; / * File attribute * / INT ff_ftime; / * File time * / INT ff_fdate; / * File date * / f FF_FSIZE; / * File length * / cer ff_name [13]; / * file Name * /}} ┗┗━━━━━┛┛━━━━━━━━┛┛┛┛━ 为 为 为 为 为 为 属 属 属┏ 代┏ 代 代 代 代 代━━━━━━━━━━━ ━━━━ ┓ ┓ _ _ _ l 卷 号 号 _ _ 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 文件 ┗ 文件 ┗ 文件 ┗ ┻ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┛ ┛ ┛: struct ffblk ff; Findfirst ("*. Wps", & ff, fa_rdonly);

INT FINDNEXT (STRUCT FFBLK * FFBLK) Repeates Findirst's files, successfully returns 0 Void FuMege (Char * Dir, Char * Name, Char * ext) This function passes drive Drive (C:, A:, etc.), path DIR (/ TC, / BC / lib, etc.), file name Name (TC, WPS, etc.), extension ext (.exe, .com, etc.) form a file store and PATH. Int fnsplit (char * path, char * drive, char * dir, char * name, char * ext) This function breaks down the file name PATH into a disk DRIVE (C:, A:, etc.), path DIR (/ TC, / BC / LIB, etc.), file name Name (TC, WPS, etc.), extension ext (.exe, .com, etc.) and deposit into corresponding variables. INT getCurDir (int DRIVE, CHAR * DIREC) This function returns the specified drive The current work directory name. Successfully returned 0 Drive Specified drive (0 = Current, 1 = A, 2 = B, 3 = C, etc.) DIREC Save Variables of the Specifies Drive Current Work Path Char * getCwd (Char * BUF, IINT N) This function takes the current work The directory is stored in BUF until the N-byte length is long. Error Returns NULL INT GETDISK () Take a drive that is currently in use, returns an integer (0 = a, 1 = B, 2 = C, etc.) int SetDisk INT Drive) The drive drive to use (0 = a, 1 = b, 2 = c, etc.), returns to build a new directory Pathname using the total number of drives, and successfully returns 0 int RMDir (charr * Pathname Delete a directory PathName, successfully returned 0 Char * mktemp (char * template) Constructing a file name not in a current directory and stores a file file file file file file file file file file file file file in TemPlate, this The function uses the DOS's path variable, and does not find the file to return the NULL process function. The function library is stdlib.h, and the process.h void abort () This function writes a termination information in stderr by calling _exit with export code 3, and abnormally Terminate the program. No return value

Int Exec ... loading and running other programs int execl (char * arg1, char * arg0, char * arg1, ..., char * argn, null) int execle (char * pathname, char * arg0, char * arg1, ..., char * Argn, ​​NULL, CHAR * ENVP []) int execlp (char * pathname, char * arg0, char * arg1, ..., null) int execlpe (char * pathname, char * arg0, char * arg1, ..., null, char * Envp []) int execv (char * pathname, char * argv []) int execve (char * pathname, char * argv [], char * envp []) int execvp (char * pathname, char * argv []) Int Execvpe (Char * Pathname, Char * Argv [], Char * Envp [])

The EXEC function is loaded and runs the program Pathname and passes the parameter arg0 (arg1, arg2, argv [], envp []) to the subroutine, error returns -1. In the Exec function family, the suffix L, V, P, E are added to EXEC, and the specified function will have some operational capabilities. When there is suffix P, the function can use the DOS's PATH variable to find the subroutine file. l When the number of parameters transmitted in the function is fixed. v When the function passed is not fixed. E, the function passes the specified parameter ENVP, allows the environment where the sub-process is allowed, the sub-process uses the current program. Void_exit (int stat (int stat (int stat (int stat (int stat (int status) termination of the current program, turn off all files, write the output of the buffer (wait for the output), and call any register "exit function", no return value

INT SPAWN ... Run Program Int Spawnl (int mode, char * pathname, char * arg0, char * arg1, ..., char * argn, null) int Spawnle (int mode, char * pathname, char * arg0, char * arg1, ..., Char * Argn, ​​NULL, CHAR * Envp []) int Spawnlp (int MODE, CHAR * PATHNAME, CHAR * ARG0, CHAR * Arg1, ..., char * argn, null) int Spawnlpe (int mode, char * pathname, Char * arg0, char * arg1, ..., char * argn, null, char * envp []) int Spawnv (int mode, char * pathname, char * argv []) int spawnve (int mode, char * pathname, char * Argv [], char * envp []) int Spawnvp (int mode, char * pathname, char * argv []) int Spawnvpe (int mode, char * pathname, char * argv [], char * envp [])

The spawn function is running the subroutine Pathname in the MODE mode and passes the parameter arg0 (arg1, arg2, argv [], envp []) to the subroutine. Error returns -1 Mode to run mode: Mode is represented in subroutine After running, return this program P_NOWAIT to run this program (not available) p_overlay while running the subscriber after this program is exited.

In the spawn function family, the suffix L, V, p, and e add to the spawn, when the specified function will have a plurality of operational capabilities, the function passes the parameters of the function using the DOS Path lookup subroutine file. When the number is fixed. V, the number of parameters passed is not fixed. E, the specified parameter ENVP can be passed to the subroutine, allowing to change the subroutine running environment. When the suffix E, the subroutine uses the environment of this program.

INT System (Char * Command) passes the MSDOS command Command to DOS execution of the converter subroutine, the library is math.h, stdlib.h, ctype.h, float.h char * ECVT (Double Value, int NDIGIT, INT * DECPT INT * SIGN converts floating point value VALUE into a string and returns the string char * FCVT (Double Value, Int NDIGIT, INT * DECPT, INT * SIGN) converts floating point VALUE into a string and returns the string char * GCVT (Double Value, Int NDIGIT, CHAR * BUF) converts the number Value into a string and returned to BUF's pointer char * ULTOA (unsigned long value, char * string, int Radix) will not be symbolically integrated The number Value converts the string and returns the string, and RADIX uses the base char * LTOA (Long Value, Char * String, INT RADIX) for the conversion, converts long-interanging value VALUE into a string and returns the string, RADIX is The base char * ITOA (int value, char * string, int RADIX) is converted into strings to store String, and Radix is ​​converted to a string NPTR to double precision when the base number Double ATOF (Char * nptr) is converted into a double precision. Number, and return this number, the error returns 0 int atoi (char * nptr) converts the string nptr into an integer number, returns this number, error Returns 0 long atol (char * nptr) converts the string NPTR conversion growth integer Number, and return this number, the error returns 0 Double StRTOD (Char * Str, Char ** Endptr) converts the string STR to the double precision, and returns this number, Long Strtol (char * str, char ** Endptr, Int Base "converts the string STR to the total number, return this number, INT TOASCII (INT C) Returns the corresponding ASCII INT TOLOWER (INT CH) If CH is uppercase letters ('A' - 'Z') returns the corresponding Small-write letters ('A'-' Z ') INT _TOLOWER (int CH) Returns CH corresponding lowercase letters (' A ' -'z ') INT Toupper (int CH) If CH is lowercase letters (' a '-' z ') returns the corresponding uppercase letters (' a'- 'z') int _toupper (int CH) Returns CH corresponding uppercase Letters ('A' - 'Z') Diagnostics, the function library is assert.h, Math.h void assert (int test) macro, if the Test test fails, showing an information and abnormal Termination programs, non-return VOID PERROR (CHAR * STRING) This function will display the most recent error message, format, string string: Error message, char * strerror (char * str) This function returns the most recent error message, format Such as: String Str: Error Message INT Matherr (Struct Exception * e) User Modify Mathematical Error Return Information Functions (Nothing Use) Double _Matherr (_Mexcep Why, Char * Fun, Double * Arg1p, Double * Arg2p, Double Retval) User Modify Mathematical error Return 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 () reads a character from the console (keyboard), not displayed on the screen Int PUTCH () Write a character int GETCHAR () from the console (keyboard) to the console (keyboard), displaying a character INT getche () from the console on the screen Int Putchar () to the console (keyboard) (Keyboard) Read a character, displayed on the screen INT UNGETCH (INT C) Returns the character C back to the console (keyboard) CGETS (Char * String) from the console (keyboard) read the string in string in the string Int Scanf (char * format [, argument ...] reads a string from the console, assigns each parameter, using the BIOS to output int vscanf (char * format, valist param) from the console into a string, Assign each parameter, using the BIOS for output, the parameters acquire int CSCANF (Char * Format [, Argument ...] from the Valist Param, read a string from the console, assigning each parameter, directly to the console Operation, such as the display when the display is displayed when the character is displayed, INT SSCANF (Char * String, Char * FORMAT [, Argument, ...]), assigns VSSSSSSCANF for each parameter, respectively, respectively. Int vsscanf (char * String, Char * Format, Vlist Param This is assigned to each parameter, and the parameters are assigned from the VList param to the console (display), using BIOS. Output Void CPUTS (CHAR * STRING) Send a string string to the console (display), directly on the control table, such as the display is directly written, INT (* ssignal (int SiG, int (* action) () ) () Execute software signals (unnecessary) INT GSIGNAL (INT SIG) executes software signals (no need to use)

INT _OPEN (CHAR * PATHNAME, INT Access) to open a file for reading or writing, press Access to determine whether reading file or write files, Access values ​​see the table below - ────────── ────────── ─ ┐ │ACCESS value │ │ ├──────────────────────────── │O_RDONLY │ Read File │ │O_WRONLY │ │ │O_RDWR │ │ │ │O_NOINHERIT │ If the file is not passed to the subroutine, it is included │ │O_Denyall │ only allows the current handleable file │ │O_Denywrite │ Allows from any other open file read │ │O_DENYREAD │ Allows from any other open file │ │O_DENYNONE │ allows other shared files │ └─────────────────────── ─────────── ─ ┘ ┘ ┘ ((int permiss) For reading or writing, pressing a file, press Access to determine whether reading file or write files, Access See the table below - ─ ────────────── ─ ─ │ACCESS │ Significance │ ├───────── ───────── ─ ┤ │O_RDONLY│T reading file │ │O_WRONLY│ 写 文件 │ │O_RDWR │ │ │ │O_NDELAY│No; Neix System Compatible │ │O_APpend│ 即 Read Also written, but each time Write always add │ │O_CREAT │ if the file exists, this flag is useless; if there is no existence, the new file │ │O_TRUNC │ If the file exists, the length is intercepted 0, the property is unchanged │ │O_EXCL │ unused; To unix system compatibility │ │O_BINARY│ This flag can be displayed in binary to open file │ │O_TEXT │ This flag can be used to give a text to open files │ └ --──────── ────────────── ─ ┘ Permiss is file attribute, can be the following value: S_IWRITE allows writing S_IREAD to read S_IREAD | S_IWRITE to allow reading, write int Creat (Char * filename, int permiss) to establish one New file filename, and set read and write. Permiss is read or written for file, allowing the following value S_IWRITE to write S_IREAD to allow reading, INIREAD | S_IWRITE to allow reading, write int _CREAT (CHAR * FileName, int Attrib) to establish a new file filename, and set file properties. Attrib for file properties, you can hide the following value FA_RDONLY read-only FA_HIDDEN hide the FA_SYSTEM system INT CreatNew (Char * filenamt, int attrib) to create a new file filename, and set file properties.

Attrib for file properties, you can hide the following value FA_RDONLY read-only FA_HIDDEN hide the FA_SYSTEM system INT CreatTemp (Char * filenamt, int attrib) to create a new file filename, and set file properties. Attrib for file properties, you can hide the following value FA_RDONLY read-only FA_HIDDEN hide the FA_SYSTEM system int ie, the NBYTE "from the file number is written in the file number, the NBYTE" is stored in BUF INT _READ (INT HANDLE) , void * buf, int nbyte) Read NBYTE characters from the file number to the file number to store the NBYTE, directly call MSDOS to operate. Int Write (int Handle, Void * BUF, INT NBYTE) Put the NBYTE in BUF The character writes the file number in the file number in the file number INT _WRITE (INT HANDLE, VOID * BUF, INT NBYTE) Write the NBYTE character in the BUF to the file number in the file number, Int Dup (int Handle) Copy a file processing pointer Handle, returning this pointer int DUP2 (INT HANDLE, INT NEWHANDLE) Copy a file processing pointer Handle to NewHandle Int EOF (INT * HANDLE) Check if the file ends, end returns 1, otherwise returns 0 long fileLength Returns the file length Handle is the time for the file number for the file number Int setmode (int Handle, Unsigned Mode) to set the file number to open the file number INT getftime (int Handle, Struct ftime * ftime) Read the file number for the file number And save the file time in the FTIME structure, successfully returned 0, the FTIME structure is as follows: ┌───────────── │Struct FTIME │ │ {│ │ unsigned ft_tsec: 5 ; / * Second * / │ │ unsigned ft_min: 6; / * 分 * / │ │ unsigned ft_Hour: 5; / * * / │ │ unsigned ft_day: 5; / * day * / │ │ unsigned ft_month: 4; / * Month * / │ │ unsign ED ft_year: 1; / * year -1980 * / │ │} │ └ - ──────────── ┘ int setftime (int Handle, Struct FTIME * FTIME) Overwrites file number For the handle of Handle, the new time is in the structural 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 * / │ │} │ └ - ─────────────────────────────────────────────────────────────────────gyongişmlikin The file's pointer is moved to the origin of the release. Seek_set file Switch seek_cur Current location SEEK_END File Tail Long Tell (INT HANDLE) This function returns the file number to the handle file pointer, indicating ISATTY in byte (Int Handle) This function is used to take the type of INT LOCK (INT HANDLE, Long Offset, Long LENGTH) to the file shared Int Unlock (INT HANDLE, Long Offset, Long Length) Opens the block shared Int Close (Int Handle) Close the file processing represented by Handle, handle is from _CREAT, CREAT, CREATNEW, CREATTEMP, DUP, DUP2, _OPEN, and one of the files obtained from one of _creat, dup2, _open, and Open. _close (int Handle) Close the file processing represented by Handle, handle is from _CREAT, CREAT, CREATNEW, CREATTEMP, DUP, DUP2, _OPEN, and one of the files obtained in one of the time in Open, otherwise returning -1, only Can use for MSDOS systems

FILE * FOPEN (Char * filename, char * type) Opens a file filename, open mode is Type, and returns this file pointer, Type can add a suffix to the following string - ┬─────── ─ ┬────── ─ ┐ │TYPE│Express │ Text / 2 credit │ Building / Open Old File │ ├─┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─────── ─ ┤ │R │ │ │ Open Old File │ │W │ 写 │ │ │ │ │ Text │ Open Volume to Built │ │R │ Read / │ 无 限 │ Open │ │W │ Read / write │ 无 限 │ 建 新 文件 文件 │ │A │ Read / Add │ Unlimited │ There is an open area to build │ └───────────────────────────────────────────────────────────────────────── ─ ┴────────── ┘ can be added to T, B.

Plus B indicates that the document is operated in binary form, T is not necessarily used: ┌ --──────────────── │ │ │MAIN () │ │ {│ │ File * fp; │ │ │FP = FOPS.exe, "R B"); │ └────────────── ─ ─ ┘ File * fdopen (int ahndle, char * type) file * Freopen (Char * filename, char * type, file * stream) INT GETC (File * Stream) reads a character from the stream stream and returns this Character INT PUTC (INT Ch, File * Stream) Writes a character ch INT GETW (File * Stream) from the stream stream into an integer, error Returns EOF INT PUTW (Int W, File * Stream) Stream Stream Write an integer int ungetc (Char C, File * Stream) Returns the character c back to the stream stream, the next read character will be C int FGetc (File * Stream) to read a character from the stream stream and return this character. INT FPUTC (INT CH, File * Stream) CHAR * FGETS (CHAR * STRING, INT N, FILE * STREAM) from Stream Stream from the stream stream (char *) String, File * Stream) Write string string to stream Stream INTFREAD (Void * PTR, int size, int nitems, file * stream) reads NITEMS in the stream stream to store NITEMs in a string in the PTR INT FWRITE (Void * PTR, INT Size, INT NITEMS, FILE * STREAM) Writes a string of NITEMS for size in the stream stream, string in Ptr in PTR NT fscanf (file * stream, char * format [, argument, ...]) reads a string int vfscanf (File * Stream, Char * Format, Valist param) in formatted form to format the form from streaming A string is read in the stream. The parameters take int fprintf (file * stream, char * format [, argument, ...]) from the Valist Param to format a string to the specified stream Stream Int Vfprintf (file * Stream, Char * Format, Valist Param) Write a string to the specified stream stream in formatted form, the parameter gets the int FSeek (File * Stream, long offset, int.comwhere) function from the Valist Param to FROMWHERE The backward OFFSET by the position, fromwhere can be the following value: seek_set file switch seek_cur Current location seek_end file tail long ftell (file * stream) function Returns the current file pointer position positioned in Stream, in byte INT REWINININT FCLOSE (File * Stream) Close a stream, which can be a file or device (for example, LPT1) Int fcloseall () Close all streams except STDIN or STDOUT Turn off a stream,

The buffer is processed by the buffer, and the stream is read, and the content is read into the buffer; the stream of the buffer is written, and the contents of the buffer are written. Successfully returned 0 int fflushall () Close all streams, and conveys the respective buffer works processing, that is, the stream is read, and the content is read into the buffer; the write stream, write the contents in the buffer. Successfully Returns 0 INT Access (CHAR * FileName, Int Amode) This function checks file filename and returns the properties of the file. The function exists in Amode. Amode is written by the combination of the following bits. You can read 02 can be read. 01 Perform (ignored) 00 file existence If FileName is a directory, the function will only determine if the directory exists to perform successful returns 0, otherwise returns -1 int chmod (int permiss) This function is used to set file filename The attribute Permiss can allow the following value S_IWRITE to write 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 attribute of the function sets the file is set to one of the following constants, FA_RDOONLY read-only FA_HIDDEN hide 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) Delete file filename unsigned fp_off (Void Far * Farptr This function is used to take far pointer FARPTR offset unsigned fp_seg (Void Far * Farptr) This function is used to do not set the segment value Void Far * mk_fp (unsigned seg, unsigned off) according to segment seg and offset according to segment SEG and offset The amount OFF constructs a FAR pointer unsigned getPSP () decreasing segment prefix segment address, and returns this address char * PARSFNM (CHAR * CMDLINE, STRUCT FCB * FCBPTR, INT OPTION) function to analyze a string, usually, for a file name For a command line referred to by cmdline. The file name is put in an FCB as a drive, file name, and extension. Fcb is specified by FCBPTR. Option parameter is when the DOS analysis system call, Al text Value. INT ABSREAD (INT Drive, Int Nsects, Int Sectno, Void * Buffer) This function function is read to read a specific disk sector, Drive is the driver number (0 = a, 1 = b, etc.), nsects is the fan to read. Regional, sectno started logical sector number, buffer to save the read data for the save space INT Abswrite (int DRIVE, INT NSECTS, INT Sectno, Void * Buffer) This function is written to write a specific disk sector, Drive is drive No. (0 = a, 1 = b, etc.), Nsects is the number of sectors to be written, and SECTNO starts logical sector number, buffer is the space where the data is saved Void getDfree (int Drive, Struct Dfree * DFreeP) this The function is used to take the free space of the disk, and Drive is a disk number (0 = Current, 1 = A, etc.). The function puts the DFREE structure of the disk characteristic by DFreeP. DFree structure is as follows: ┌───────── ────────── │STRUCT DFREE │ │ { │ │ Unsigned DF_AVAIL; / * Useful cluster number * / │ │ unsigned df_total; / * Total cluster number * / │ │ unsigned DF_BSEC; / * Each sector Number * / │ │ unsigned DF_SClus; / * A clustered sector number * / │ │} │ └ --───────────────────────────────────── ─ ─ ┘ Char far * getdta () Take the disk conversion address DTA Void setdta (Char Far * DTA ) Sets the disk conversion address DTA Void getfat (int drive) This function returns the file allocation table information of the specified drive Drive (0 = current, 1 = A, 2 = B, etc.) and stored in the structural FATBLKP, the structure is as follows : ┌ --──────────── ┐ │STRUCT Fatinfo │ │ {│ │ Char Fi_SClus; / * Each cluster sector number * / │ │ CHAR FI_FACID; / * Distribution table byte number * / │ │ │ INT FI_NCLUS; / * Cluster number * / │ │ INT FI_BYSEC;

/ * Number of bytes per sector * / │ │} │ └──────────────────┘ void getfatd (struct fatinfo * fatblkp) This function returns the current drive file Distributing table information, and deposited in structural FATBLKP, the structure is as follows: ┌ --─────────────── │ │ │ CHAR FI_SCLUS; / * Each cluster Sector number * / │ │ Char fi_fatid; / * File allocation table byte number * / │ │ │ │ │ │ in │ │ │ 字 字 * / │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ } │ └ - ──────── ┘ Int BDOS (int DOSFUN, UNSIGNED DOSDX, Unsigned Dosal This function is called, DOSDX is the value of the register DX, DOSAL For the value of the register Al, DOSFUN is called the MSDOS system for the function number INT BDOSPTR (INT DOSFUN, VOID * Argument, Unsiigned Dosal) This function is called, and the argument is the value of the register DX, and DOSAL is the value of the register Al, and DOSFUN is function ID INT. INT86 (int INTR_NUM, Union Regs * INREGS, Union Regs * Outregs) Execute INTR_NUM number, the user-defined register value is stored in archregs, and the returned register value is stored in Outregs after execution. INT INT86X (int INTR_NUM , UNION REGS * OUTREGS, STRUCT SRUCT SRUCT SRUCT SRUCT SRUCT SRUCT SREGS * SEGREGS "Execute the INTR_NUM number, and the user-defined register value is stored in the structure inregs and the structure Segregs, and the returned register value is stored in the structure Outregs after execution. int INTDOS (Union Regs * Outregs) This function executes the DOS interrupt 0x21 to call a specified DOS function, the user-defined register value exists in INREGS, and the function will be returned to the returned register value in Outregs INT INTDOSX (Union Regs * INREGS, Union Regs * OUTREGS, STRUCT SREGS * SegRegs This function performs DOS interrupt 0x21 to call a specified DOS function, the user-defined register value exists in INREGS and SegRegs, and executes the returned register value in Outregs in Outregs. Void INTR (int INTR_NUM, STRUCT REGPACK * PREG) This function is an alternate 8086 software interrupt interface that generates a 8086 software interrupt specified by the parameter INTR_NUM. The function is replicated from the structure preg replicated user-defined registers before executing the software interrupt. Each register. After the software is complete, the function copys the value of the current registers to the structure preg. The parameters are as follows: INTR_NUM executed interrupt number, preg is the structure of the user-defined register value, the structure is as follows ---- ─────────────────┐ │struct REGPACK │ │ {│ │ unsigned r_ax, r_bx, r_cx, r_dx; │ │ unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags;

│ │} │ └ - ───────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ Size returns to MSDOS in Status, but the program remains in memory, and the occupied space is determined by the Size. Void CtrlBrk (int (* fptr) ()) Sets the interrupt handler after the interrupt. Void disable () prohibits the occurrence Interrupt Void Enable () allows interrupt VOID GENINTERRUPT (INT INTR_NUM) to execute the software interrupt by INTR_NUM (* getVect (int INTR_NUM)) () returns an interrupt handler for INTR_NUM, for example: OLD_INT_10H = GetVect 0x10); Void setVect (int INTR_NUM, VOID INTERRUPT (* ISR) ()) Settings the interrupt handler for INTR_NUM is ISR, for example: setVect (0x10, new_int_10h); Void Harden (int (* fptr) ()) Define a hardware error handler. Whenever an error occurs Read a word and return this word int inportb (int port) to read a byte from the specified input port and return this byte void output (int port, int Word) to write the word Word to the specified output port Port Port. Void OutportB (int port, char Byte) Write the byte Byte to the specified output port port int peek (int segment) function returns a segment: a word CHAR PEEKB (INT Segment, unsigned offset) function at Offset function Returns segment : A byte Void Poke at the Offset (int segment SET, CHAR VALUE Write the word value to segment: offset Void Pokeb (int segment, int offset, int value) Write byte value to segment: Offset The int RAMBRD (Struct FCB * fcbptr, int RECNT) function is opened FCBPTR refers to the FCB read RECCNT record. INT RANDBWR (struct fcb * fcbptr, int RECCNT) function writes the RECCNT record in the FCB referred to in FCBPTR to the Void Segread (Struct Sregs * segtbl) function to set the segment register The current value is placed in the structure segtbl in the current state of the inspection mark (0 = inspection, 1 = verification Open) Void setVerify (int value) Set the current inspection status, value 0 indicates the shutdown test, 1 means open Test INT getcBRK () This function returns the current setting of the interrupt detection INT setcBrk (int value) This function is used to set the control interrupt to switch on or disconnect as Value = 0, which is disconnected. When Value = 1 For the detection of int DOSEXTERR (Struct Doserr * eblkp) to remove an extended error. After the DOS error occurs, this function fills the extended error message in the Doserr structure referred to EBLKP. This structure is defined as follows: ┌────────── ────────── ┐ │STRUCT DOSERR │ │ {│ │ Int EXTERROR;

/ * Extended 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, the CMD can be the following value: 0 communication parameters are bytes, such as: 0xE0 | 0x08 | 0x00 | 0x03 means that the communication port is 9600 baud, odd parity, 1 stop bit, 8 data bits. The return value of the function is a 16-bit integer, defined as follows: The 15th timeout 14th transfer shift register is 13th Transfer Fixed Register Empty 12th Interrupt Detection 11th Frame Error 10th Parity Error 9th Overload Run Error 8th Data Ready 7th Receive Line Signal Detection The 6th Ring Indicator 5th Data Setting Ready 4-bit clearance Send 3-bit Δ Receiver Line Signal Detector 2nd Decentric Side Ring Detector No. 1 Data Setting Ready 0th Bit δ Clear Int BiosDisk (int CMD, Int Drive, Int head, int track, int Sector, int nsects, void * buffer This function is used to make a certain operation for the drive, 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. 1 Return to the last hard disk operation status. Ignore all other parameters 2 read one or more disk sectors to memory. Read the sector Given by Head, Track, Sector. The sector number is given by nsects. Reading 512 bytes of data of each sector into buffer 3 writes from memory read data to one or more sectors. The sector written by Write is given by Head, Track, and Sector. The sector number is given by nsects. Write data in Buffer, 512 bytes per sector. 4 Test one or more sectors. Start the sector by Head, Track, Sector. The sector number is given by nsects. 5 Format a track, which is given by Head and Track. Buffer points a table to the sector header written on the specified track. The following CMD values ​​are only allowed for XT or AT microcomputers: 6 formatted a track, and set a bad sector flag. 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 Perform a long reading, each sector reading 512 plus 4 additional bytes 11 Perform a long writing, each sector write 512 plus 4 additional bytes 12 Perform a disk lookup 13 alternate disk reset 14 read fan District buffer 15 write sector buffer 16 Check the specified drive to be ready 17 Review Drive 18 Controller RAM Diagnostics 19 Drive Diagnostics 20 Controller Interior Diagnosis

Function returns the status byte by the following bits: 0x00 operation success 0x01 bad command 0x02 address tag found 0x04 record could not find 0x05 reset failed 0x07 driver parameter activity failed 0x09 attempt DMA After 64K limit 0x0b inspection of bad disk Mark 0x10 Direct ECC Read 0x11 ECC Correction Data ECC (Note It Not Error) 0x20 Controller Failure 0x40 Finding Failed 0x80 Response Connection Failure 0xBB Disabled Error 0xFF Read Operation Failure

INT biodquip () checks the device, the function returns a byte, which represents a message, as follows: 15th printer number 14th printer number 13th unworthoped game I / O No. 11 The 8th bit of the RS232 port number did not use the seventh-bit soft disk number, the 6th-bit soft disk number, 00 is No. 2 driver, 10 is the No. 3 driver, 11 is the No. 4 driver

The 5th place initialized the 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 2nd random memory capacity, 00 Ten, 01 is 32K, 10 is 48k, 11 is 64K First Pointers to Slide Processor 0th Bit From Soft Disk Boot Int Bioskey (INT CMD) This function is used to perform various keyboard operations, determined by CMD. The 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, 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 Returns the current keyboard status, which is represented by each bit of an integer, see the table: ┌ - ┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ 0 0 意 意 意 1 1 意 意 意 意 意 状态 ┼ ┼ 状态 状态 ┼ ┼ 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态│ 大写 │ │ 5 │ Digital Status, Numlock Lights Light │ Corbital Status, Numlock Lights Off - │ │ 4 │Scrollock Lights Light │Scrolllock Lights Off │ │ 3 │ALT Press │ALT Unpaid │ │ │CTRL Press Lower │CTRL unpub │ │ 1 │ left Shift Press │ Left Shift Unforce │ │ 0 │ Right Shift Press │ Right Shift Unforgettable │ └ - ┴──────── ┴───────── ─ ┘ INT BiosMemory () Returns the memory size, in 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 and other CMDs may be the following value: 0 print characters, send character BYTE to the printer 1 Printer port Initialization 2 Read the printer status function Return value consisting of the following bit value indicating the current printer status 0x01 device Time timeout 0x08 input / output error 0x10 selected 0x20 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, STRUCTRUCTRY * Countryp) This function is used to control relevant information in a country, such as date, time, currency, etc. If countryp = -1, the current country is set to Countrycode value (must be Non 0). Otherwise, the COUNTRY structure pointed by the CountryP: (1) Current country (if countrycode is 0 or 2), the country given by CountryCode. Structure 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]; / * Decan Point * / │ │ CHAR CO_DTSEP [2]; / * Date Separator * / │ │ CHAR CO_TMSEP [2 ]; / * Time separator * / │ │ char CO_CURRSTYLE; / * Money 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: the currency display of the value of the value of CO_CURRSTRLE, the month of the 0 months of the 0 month, the currency symbol is in front of the value, and the monetary symbol is in the numerical value. In the middle without space 2 currency symbols, there is a space 3 currency symbol after the value, the space has a space function function, the function library is string.h, mem.h mem ... operation Storage group 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)

All members of these functions, all members of the MEM ... series are operated. In all of these functions, arrays are N-bytes long. Memcpy copies an N-byte block to Destin from Source. If the source block and target block are overlap it, Then select the replication direction to correctly copy the overlay bytes. Memmove is the same as Memcpy. MEMSET places all the words S in the byte CH. The length of the array is given by n. MEMCMP is exactly the n-byte Long two strings S1 and S2. Some functions Compare bytes in unsigned characters, so Memcmp ("0xFF", "/ x7f", 1) return value is greater than 0. MemicMP compares the first n word of S1 and S2 Section, regardless of the character capital or lowercase. Memccpy Copy byte from Source to Destin. The following is the following: (1) Character CH preferred copy to Destin. (2) N-bytes have been copied to Destin. Memchr Retrieve the front n bytes of the S array in characters. Return Value: Memmove and Memcpy Return to Destin MemSet Returns Memcmp and Memicmp─ ─ ─ ─ ─ ┬ S1

Void MoveData (int SEGSRC, int offsrc, int segDest, int offdest, unsigned number) This function copies the NumBytes bytes at SEGSRC: OFFSRC to the target address (SegDest:

Offest) Void MoveMem (Void * Source, Void * Destin, Unsigned LEN) This function is copied from the Source to Destin. If the source address and destination address string are overlapped, 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 Addr in byte Value. STR ... String Operation Function CHAR STPCPY (Char * Dest CONST CHAR * SRC) Copy the string SRC to DEST CHAR STRCAT (CHAR * DEST, Const Char * SRC) Add String SRC to Dest, CHAR STRCHR (Const Char * S, INT C) to retrieve and return characters C The first occurrence of the first occurrence of string s INT STRCMP (const char * s1, const char * s2) compares the size of the strings S1 and S2, and returns S1-S2 CHAR STRCPY (CHAR * DEST, CONST CHAR * SRC) String SRC is copied to DEST SIZE_T STRCSPN (Const Char * S1, Const Char * S2) Scan S1, returns to S1, and some characters in S2 are also copied to copy string S to Recently established unit int STRICMP (Const Char * S1, Const Char * S2) compares strings S1 and S2, and returns the length of the S1-S2 Size_t Strlen Returns Char Strlwr (CHAR * S) Convert all uppercase letters in the string S to lowercase letters, and return the converted string char strncat (char * dest, const char * src, size_t maxlen) to copy the most maxlen characters in the string SRC to string DEST INT STRNCMP (Const Char * S1, Const Char * S2, SIZE_T MAXLEN) Compare Strings S1 and S2 Pre-Maxlen Compact CHAR STRNCPY (CHAR * DEST, Const Char * SRC, SIZE_T MAXLEN) Copy the first M in SRC Axlen characters to int STRNICMP (Const Char * S1, Const Char * S2, SIZE_T MAXLEN) Compare Strings S1 and S2 Pre-Maxlen Compact CHAR STRNSET (CHAR * S, INT CH, SIZE_T N) Tuning The first n characters of S are placed in CHAR STRPBRK (const char * s1, const char * s2) scan string S1, and return characters in S1 and S2, the number of characters, CHAR STRRCHR (Const Char * S, INT) c) Scan a string S Char Strrev (char * s) in which a given character C is displayed will rearrange the characters in the string S and return to the arranged string char strs (char * s, int CH) Put all characters in a string S in a given character ch size_t strs scanning string S1, and returns the number of characters in S1 and S2 CHAR STRSTR (const char * s1, const char * S2) Scan string S2, returns to the first time S1 position char start CHAR STRTOK (CHAR * S1, Const Char * S2) retrieval string S1, the string S1 is The delimiter defined in string s2 is separated by CHAR STRUPR (CHAR * S) to convert all lowercase letters in the string S to uppercase letters and return the conversion string.

Storage distribution subroutine, the function library is dos.h, alloc.h, malloc.h, stdlib.h, process.h int allocmem (unsigned size, unsigned * seg) using DOS assignment free memory, size is allocated memory Size, SEG is allocated memory pointer int freemem (unsigned seg) release the memory allocated by allocmem, SEG is used for the specified memory pointer Int setBlock (int seg, int newsize) This function is used to modify the assigned memory length, SEG For memory pointers that have allocated memory, Newsize is the new length INT brk (void * endds) this function to change the number of space assigned to the data segment assigned to 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 assigned to the calling program, increasing the space of the INCR byte UNSigned long core () This function returns the length of the unused storage area, in bytes, Void * Calloc (unsigned NELEM) , unsigned elsize assigns NELEM length to ELSIZE memory space and returns the pointer VOID * malloc (unsigned size) assigned the SIZE byte, and returns the pointer of the assigned memory Void FREE (Void * PTR) Release the internal allocated memory, the pointer to the memory to be released is the size of the allocated memory, the PTR is the pointer that has been allocated, and newsize is new, return Assigned a good memory pointer. Long farcoreleft () This function returns the length of the unused storage area in the distortion, with bytes Void Far * Farcalloc (unsigned long sets, unsigned long setsz) from the far-referential UnitS length Units's memory space, and returns the pointer void * farmalloc (unsigned long size) assigned the SIZE byte, and returns the assigned memory pointer Void Farfree (Void Far * Block) released previously allocated Memory space, the pointer to the far-resembled memory to be released is Block Void Far * Farre Alloc (Void Far * Block, Unsigned Long News) Changes the size of the allocated far-resemble, Block is a pointer assigned with a memory area, NewZie is a new length, returns the assigned memory pointer

The time date function, the function library is Time.h, DOS.H In the time date function, the mainly used structure has the following: Total time date Storage structure TM ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ──────── ─ │STRUCT TM │ │ {│ │ INTTM_SEC; / * Second, 0-59 * / │ │ INTTM_MIN; / * Pie, 0-59 * / │ │ INTTM_HOUR; / * When 0-23 * / │ │ INTTM_MDAY; / * Number, 1-31 * / │ │ INTTM_MON; / * Month, 0-11 * / │ │ INTTM_YEAR; / * Since 1900's number * / │ │ INTTM_WDAY; / * Since the day of the day 0-6 * / │ │ INTTM_YDAY; / * Since January 1st, 0-365 * / │ │ INTTM_ISDST; / * Whether to use a summer time system, The positive number * / │ │} │ └ - ────────────────────────────────────────────────────────── ─ ─ ┐ │STRUCT DATE │ │ {│ │ Int Da_Year; / * Since 1900 Number * / │ │ │ │ │ │ CHAR Da_MON; / * Month 1 = Jan * / │ │ │ │ │ └ - ─ ─ ─ ──────────────────────────────────── │STRUCT TIME │ │ {│ │ unsigned CHAR TI_MIN; / * * / │ │ unsigned char Ti_HOUR; / * Hours * / │ │ unsigned char Ti_hund; │ │ unsigned char Ti_sec;

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

New Post(0)