资源描述
函数名:abort
功 能: 异常终止一个进程
用 法: void abort(void)
函数名: abs
功 能: 求整数的绝对值
用 法: int abs(int i)
函数名: absread, abswirte
功 能: 绝对磁盘扇区读、写数据
用 法: int absread(int drive, int nsects, int sectno, void *buffer)
int abswrite(int drive, int nsects, in tsectno, void *buffer
函数名: access
功 能: 确定文件的访问权限
用 法: int access(const char *filename, int amode)
函数名: acos
功 能:反余弦函数
用 法: double acos(double x)
函数名: allocmem
功 能: 分配DOS存储段
用 法:int allocmem(unsigned size, unsigned *seg)
函数名: arc
功 能: 画一弧线
用 法:void far arc(int x, int y, int stangle, int endangle, int radius)
函数名: asctime
功 能: 转换日期和时间为ASCII码
用 法:char *asctime(const struct tm *tblock)
函数名: asin
功 能:反正弦函数
用 法: double asin(double x)
函数名: assert
功 能: 测试一个条件并可能使程序终止
用 法:void assert(int test)
函数名: atan
功 能: 反正切函数
用 法: double atan(double x)
函数名: atan2
功 能: 计算Y/X的反正切值
用 法: double atan2(double y, double x)
函数名:atexit
功 能: 注册终止函数
用 法: int atexit(atexit_t func)
函数名: atof
功 能: 把字符串转换成浮点数
用 法:double atof(const char *nptr)
函数名: atoi
功 能: 把字符串转换成长整型数
用 法: int atoi(const char *nptr)
函数名: atol
功 能: 把字符串转换成长整型数
用 法: long atol(const char *nptr)
函数名: bar
功 能: 画一个二维条形图
用 法: void far bar(int left, int top, int right, int bottom)
函数名: bar3d
功 能: 画一个三维条形图
用 法:void far bar3d(int left, int top, int right, int bottom,
int depth, int topflag)
函数名: bdos
功 能: DOS系统调用
用 法: int bdos(int dosfun, unsigned dosdx, unsigned dosal)
函数名:bdosptr
功 能:
DOS系统调用
用 法: int bdosptr(int dosfun, void *argument, unsigned dosal)
函数名:bioscom
功 能: 串行I/O通信
用 法:int bioscom(int cmd, char abyte, int port)
函数名:biosdisk
功 能: 软硬盘I/O
用 法:int biosdisk(int cmd, int drive, int head, int track, int sector
int nsects, void *buffer)
函数名:biosequip
功 能: 检查设备
用 法:int biosequip(void)
函数名:bioskey
功 能: 直接使用BIOS服务的键盘接口
用 法:int bioskey(int cmd)
函数名:biosmemory
功 能: 返回存储块大小
用 法:int biosmemory(void)
函数名:biosprint
功 能: 直接使用BIOS服务的打印机I/O
用 法:int biosprint(int cmd, int byte, int port)
函数名:biostime
功 能: 读取或设置BIOS时间
用 法: long biostime(int cmd, long newtime)
函数名: brk
功 能: 改变数据段空间分配
用 法:int brk(void *endds)
函数名:bsearch
功 能: 二分法搜索
用 法:void *bsearch(const void *key, const void *base, size_t *nelem,
size_t width, int(*fcmp)(const void *, const *))
函数名: cabs
功 能: 计算复数的绝对值
用 法: double cabs(struct complex z);
函数名:calloc
功 能:分配主存储器
用 法:void *calloc(size_t nelem, size_t elsize);
函数名: ceil
功 能: 向上舍入
用 法: double ceil(double x);
函数名: cgets
功 能: 从控制台读字符串
用 法: char *cgets(char *str)
函数名:chdir
功 能: 改变工作目录
用 法: int chdir(const char *path);
函数名:_chmod, chmod
功 能: 改变文件的访问方式
用 法: int chmod(const char *filename, int permiss);
函数名:chsize
功 能: 改变文件大小
用 法: int chsize(int handle, long size);
函数名: circle
功 能: 在给定半径以(x, y)为圆心画圆
用 法: void far circle(int x, int y, int radius);
函数名: cleardevice
功 能: 清除图形屏幕
用 法: void far cleardevice(void);
函数名:clearerr
功 能: 复位错误标志
用 法:void clearerr(FILE *stream);
函数名: clearviewport
功 能: 清除图形视区
用 法: void far clearviewport(void);
函数名:_close, close
功 能: 关闭文件句柄
用 法:int close(int handle);
函数名: clock
功 能:确定处理器时间
用 法: clock_t clock(void);
函数名:closegraph
功 能: 关闭图形系统
用 法: void far closegraph(void);
函数名:clreol
功 能: 在文本窗口中清除字符到行末
用 法:void clreol(void)
函数名:clrscr
功 能: 清除文本模式窗口
用 法:void clrscr(void);
函数名: coreleft
功 能: 返回未使用内存的大小
用 法:unsigned coreleft(void);
函数名: cos
功 能: 余弦函数
用 法:double cos(double x);
函数名:cosh
功 能: 双曲余弦函数
用 法: dluble cosh(double x);
函数名: country
功 能: 返回与国家有关的信息
用 法: struct COUNTRY *country(int countrycode, struct country *country);
函数名: cprintf
功 能: 送格式化输出至屏幕
用 法:int cprintf(const char *format[, argument, ...]);
函数名: cputs
功 能: 写字符到屏幕
用 法: void cputs(const char *string);
函数名: _creat creat
功 能: 创建一个新文件或重写一个已存在的文件
用 法: int creat (const char *filename, int permiss)
函数名:creatnew
功 能: 创建一个新文件
用 法:int creatnew(const char *filename, int attrib);
函数名: cscanf
功 能: 从控制台执行格式化输入
用 法:int cscanf(char *format[,argument, ...]);
函数名: ctime
功 能: 把日期和时间转换为字符串
用 法:char *ctime(const time_t *time);
函数名: ctrlbrk
功 能: 设置Ctrl-Break处理程序
用 法: void ctrlbrk(*fptr)(void);
函数名: delay
功 能: 将程序的执行暂停一段时间(毫秒)
用 法: void delay(unsigned milliseconds);
函数名: delline
功 能: 在文本窗口中删去一行
用 法: void delline(void);
函数名:detectgraph
功 能: 通过检测硬件确定图形驱动程序和模式
用 法: void far detectgraph(int far *graphdriver, int far *graphmode);
函数名: difftime
功 能: 计算两个时刻之间的时间差
用 法: double difftime(time_t time2, time_t time1);
函数名: disable
功 能: 屏蔽中断
用 法:void disable(void);
函数名: div
功 能: 将两个整数相除, 返回商和余数
用 法:div_t (int number, int denom);
函数名: dosexterr
功 能: 获取扩展DOS错误信息
用 法:int dosexterr(struct DOSERR *dblkp);
函数名: dostounix
功 能: 转换日期和时间为UNIX时间格式
用 法: long dostounix(struct date *dateptr, struct time *timeptr);
函数名: drawpoly
功 能: 画多边形
用 法: void far drawpoly(int numpoints, int far *polypoints);
函数名:dup
功 能: 复制一个文件句柄
用 法: int dup(int handle);
函数名:dup2
功 能: 复制文件句柄
用 法: int dup2(int oldhandle, int newhandle);
函数名: ecvt
功 能: 把一个浮点数转换为字符串
用 法: char ecvt(double value, int ndigit, int *decpt, int *sign);
函数名: ellipse
功 能: 画一椭圆
用 法:void far ellipse(int x, int y, int stangle, int endangle,
int xradius, int yradius);
函数名: enable
功 能: 开放硬件中断
用 法: void enable(void);
函数名: eof
功 能: 检测文件结束
用 法: int eof(int *handle);
函数名: exec...
功 能: 装入并运行其它程序的函数
用 法: int execl(char *pathname, char *arg0, arg1, ..., argn, NULL);
int execle(char *pathname, char *arg0, arg1, ..., argn, NULL,
char *envp[]);
int execlp(char *pathname, char *arg0, arg1, .., NULL);
int execple(char *pathname, char *arg0, 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[]);
函数名:exit
功 能: 终止程序
用 法: void exit(int status);
函数名: exp
功 能: 指数函数
用 法: double exp(double x);
函数名: gcvt
功 能: 把浮点数转换成字符串
用 法: char *gcvt(double value, int ndigit, char *buf);
函数名: geninterrupt
功 能: 产生一个软中断
用 法: void geninterrupt(int intr_num);
函数名: getarccoords
功 能: 取得最后一次调用arc的坐标
用 法: void far getarccoords(struct arccoordstype far *arccoords);
函数名: getaspectratio
功 能: 返回当前图形模式的纵横比
用 法: void far getaspectratio(int far *xasp, int far *yasp);
函数名: getbkcolor
功 能: 返回当前背景颜色
用 法: int far getbkcolor(void);
函数名: getc
功 能: 从流中取字符
用 法: int getc(FILE *stream);
函数名: getcbrk
功 能: 获取Control_break设置
用 法: int getcbrk(void);
函数名: getch
功 能: 从控制台无回显地取一个字符
用 法: int getch(void);
函数名: getchar
功 能: 从stdin流中读字符
用 法: int getchar(void);
函数名: getche
功 能: 从控制台取字符(带回显)
用 法: int getche(void);
函数名: getcolor
功 能: 返回当前画线颜色
用 法: int far getcolor(void);
函数名: getcurdir
功 能: 取指定驱动器的当前目录
用 法: int getcurdir(int drive, char *direc);
函数名: getcwd
功 能: 取当前工作目录
用 法: char *getcwd(char *buf, int n);
函数名: getdate
功 能: 取DOS日期
用 法: void getdate(struct *dateblk);
函数名: getdefaultpalette
功 能: 返回调色板定义结构
用 法: struct palettetype *far getdefaultpalette(void);
函数名: getdisk
功 能: 取当前磁盘驱动器号
用 法: int getdisk(void);
函数名: getdrivername
功 能: 返回指向包含当前图形驱动程序名字的字符串指针
用 法: char *getdrivename(void);
函数名: getdta
功 能: 取磁盘传输地址
用 法: char far *getdta(void);
函数名: getenv
功 能: 从环境中取字符串
用 法: char *getenv(char *envvar);
函数名: getfat, getfatd
功 能: 取文件分配表信息
用 法: void getfat(int drive, struct fatinfo *fatblkp);
函数名: getfillpattern
功 能: 将用户定义的填充模式拷贝到内存中
用 法: void far getfillpattern(char far *upattern);
函数名: getfillsettings
功 能: 取得有关当前填充模式和填充颜色的信息
用 法: void far getfillsettings(struct fillsettingstype far *fillinfo);
函数名: getftime
功 能: 取文件日期和时间
用 法: int getftime(int handle, struct ftime *ftimep);
函数名: getgraphmode
功 能: 返回当前图形模式
用 法: int far getgraphmode(void);
函数名: getftime
功 能: 取文件日期和时间
用 法: int getftime(int handle, struct ftime *ftimep);
函数名: getgraphmode
功 能: 返回当前图形模式
用 法: int far getgraphmode(void);
函数名: getimage
功 能: 将指定区域的一个位图存到主存中
用 法: void far getimage(int left, int top, int right, int bottom,
void far *bitmap);
函数名: getlinesettings
功 能: 取当前线型、模式和宽度
用 法: void far getlinesettings(struct linesettingstype far *lininfo):
函数名: getmaxx
功 能: 返回屏幕的最大x坐标
用 法: int far getmaxx(void);
函数名: getmaxy
功 能: 返回屏幕的最大y坐标
用 法: int far getmaxy(void);
函数名: getmodename
功 能: 返回含有指定图形模式名的字符串指针
用 法: char *far getmodename(int mode_name);
函数名: getmoderange
功 能: 取给定图形驱动程序的模式范围
用 法: void far getmoderange(int graphdriver, int far *lomode,
int far *himode);
函数名: getpalette
功 能: 返回有关当前调色板的信息
用 法: void far getpalette(struct palettetype far *palette);
函数名: getpass
功 能: 读一个口令
用 法: char *getpass(char *prompt);
函数名: getpixel
功 能: 取得指定像素的颜色
用 法: int far getpixel(int x, int y);
函数名: gets
功 能: 从流中取一字符串
用 法: char *gets(char *string);
函数名: gettext
功 能: 将文本方式屏幕上的文本拷贝到存储区
用 法: int gettext(int left, int top, int right, int bottom, void *destin);
函数名: gettextinfo
功 能: 取得文本模式的显示信息
用 法: void gettextinfo(struct text_info *inforec);
函数名: gettextsettings
功 能: 返回有关当前图形文本字体的信息
用 法: void far gettextsettings(struct textsettingstype far *textinfo);
函数名: gettime
功 能: 取得系统时间
用 法: void gettime(struct time *timep);
函数名: getvect
功 能: 取得中断向量入口
用 法: void interrupt(*getvect(int intr_num));
函数名: getverify
功 能: 返回DOS校验标志状态
用 法: int getverify(void);
函数名: getviewsetting
功 能: 返回有关当前视区的信息
用 法: void far getviewsettings(struct viewporttype far *viewport);
函数名: getw
功 能: 从流中取一整数
用 法: int getw(FILE *strem);
函数名: getx
功 能: 返回当前图形位置的x坐标
用 法: int far getx(void);
函数名: gety
功 能: 返回当前图形位置的y坐标
用 法: int far gety(void);
函数名: gmtime
功 能: 把日期和时间转换为格林尼治标准时间(GMT)
用 法: struct tm *gmtime(long *clock);
函数名: gotoxy
功 能: 在文本窗口中设置光标
用 法: void gotoxy(int x, int y);
函数名: gotoxy
功 能: 在文本窗口中设置光标
用 法: void gotoxy(int x, int y);
函数名: graphdefaults
功 能: 将所有图形设置复位为它们的缺省值
用 法: void far graphdefaults(void);
函数名: grapherrormsg
功 能: 返回一个错误信息串的指针
用 法: char *far grapherrormsg(int errorcode);
函数名: graphresult
功 能: 返回最后一次不成功的图形操作的错误代码
用 法: int far graphresult(void);
函数名: _graphfreemem
功 能: 用户可修改的图形存储区释放函数
用 法: void far _graphfreemem(void far *ptr, unsigned size);
函数名: _graphgetmem
功 能: 用户可修改的图形存储区分配函数
用 法: void far *far _graphgetmem(unsigned size);
函数名: harderr
功 能: 建立一个硬件错误处理程序
用 法: void harderr(int (*fptr)());
函数名: hardresume
功 能: 硬件错误处理函数
用 法: void hardresume(int rescode);
函数名: highvideo
功 能: 选择高亮度文本字符
用 法: void highvideo(void);
函数名: hypot
功 能: 计算直角三角形的斜边长
用 法: double hypot(double x, double y);
函数名: imagesize
功 能: 返回保存位图像所需的字节数
用 法: unsigned far imagesize(int left, int top, int right, int bottom);
函数名: initgraph
功 能: 初始化图形系统
用 法: void far initgraph(int far *graphdriver, int far *graphmode
函数名: inport
功 能: 从硬件端口中输入
用 法: int inp(int protid);
函数名: insline
功 能: 在文本窗口中插入一个空行
用 法: void insline(void);
函数名: installuserdriver
功 能: 安装设备驱动程序到BGI设备驱动程序表中
用 法: int far installuserdriver(char far *name, int (*detect)(void));
函数名: installuserfont
功 能: 安装未嵌入BGI系统的字体文件(CHR)
用 法: int far installuserfont(char far *name);
函数名: int86
功 能: 通用8086软中断接口
用 法: int int86(int intr_num, union REGS *inregs, union REGS *outregs)
函数名: int86x
功 能: 通用8086软中断接口
用 法: int int86x(int intr_num, union REGS *insegs, union REGS *outregs,
函数名: intdos
功 能: 通用DOS接口
用 法: int intdos(union REGS *inregs, union REGS *outregs);
函数名: intdosx
功 能: 通用DOS中断接口
用 法: int intdosx(union REGS *inregs, union REGS *outregs,
struct SREGS *segregs);
函数名: intr
功 能: 改变软中断接口
用 法: void intr(int intr_num, struct REGPACK *preg);
函数名: ioctl
功 能: 控制I/O设备
用 法: int ioctl(int handle, int cmd[,int *argdx, int argcx]);
函数名: isatty
功 能: 检查设备类型
用 法: int isatty(int handle);
函数名: itoa
功 能: 把一整数转换为字符串
用 法: char *itoa(int value, char *string, int radix);
函数名: kbhit
功 能: 检查当前按下的键
用 法: int kbhit(void);
函数名: keep
功 能: 退出并继续驻留
用 法: void keep(int status, int size);
函数名: kbhit
功 能: 检查当前按下的键
用 法: int kbhit(void);
函数名: keep
功 能: 退出并继续驻留
用 法: void keep(int status, int size);
函数名: labs
用 法: long labs(long n);
函数名: ldexp
功 能: 计算value*2的幂
用 法: double ldexp(double value, int exp);
函数名: ldiv
功 能: 两个长整型数相除, 返回商和余数
用 法: ldiv_t ldiv(long lnumer, long ldenom);
函数名: lfind
功 能: 执行线性搜索
用 法: void *lfind(void *key, void *base, int *nelem, int width,
int (*fcmp)());
函数名: line
功 能: 在指定两点间画一直线
用 法: void far line(int x0, int y0, int x1, int y1);
函数名: linerel
功 能: 从当前位置点(CP)到与CP有一给定相对距离的点画一直线
用 法: void far linerel(int dx, int dy);
函数名: localtime
功 能: 把日期和时间转变为结构
用 法: struct tm *localtime(long *clock);
函数名: lock
功 能: 设置文件共享锁
用 法: int lock(int handle, long offset, long length);
函数名: log
功 能: 对数函数ln(x)
用 法: double log(double x);
函数名: log10
功 能: 对数函数log
用 法: double log10(double x);
函数名: longjump
功 能: 执行非局部转移
用 法: void longjump(jmp_buf env, int val);
函数名: lowvideo
功 能: 选择低亮度字符
用 法: void lowvideo(void);
函数名: lrotl, _lrotl
功 能: 将无符号长整型数向左循环移位
用 法: unsigned long lrotl(unsigned long lvalue, int count);
unsigned long _lrotl(unsigned long lvalue, int count);
函数名: lsearch
功 能: 线性搜索
用 法: void *lsearch(const void *key, void *base, size_t *nelem,
size_t width, int (*fcmp)(const void *, const void *));
函数名: lseek
功 能: 移动文件读/写指针
用 法: long lseek(int handle, long offset, int fromwhere);
main()主函数
每一C 程序都 必须 有一 main() 函数, 可以根据自己的爱好把它放在程序的某
个地方。有些程序员把它放在最前面, 而另一些程序员把它放在最后面, 无论放
在哪个地方, 以下几点说明都是适合的。
1. main() 参数
在Turbo C2.0启动过程中, 传递main()函数三个参数: argc, argv和env。
* argc: 整数, 为传给main()的命令行参数个数。
* argv: 字符串数组。
在DOS 3.X 版本中, argv[0] 为程序运行的全路径名; 对DOS 3.0
以下的版本, argv[0]为空串("") 。
argv[1] 为在DOS命令行中执行程序名后的第一个字符串;
argv[2] 为执行程序名后的第二个字符串;
...
argv[argc]为NULL。
*env: 安符串数组。env[] 的每一个元素都包含ENVVAR=value形式的字符
串。其中ENVVAR为环境变量如PATH或87。value 为ENVVAR的对应值如C:\DOS, C:
\TURBOC(对于PATH) 或YES(对于87)。
Turbo C2.0启动时总是把这三个参数传递给main()函数, 可以在用户程序中
说明(或不说明)它们, 如果说明了部分(或全部)参数, 它们就成为main()子程序
的局部变量。
请注意: 一旦想说明这些参数, 则必须按argc, argv, env 的顺序, 如以下
的例子:
main()
main(int argc)
main(int argc, char *argv[])
main(int argc, char *argv[], char *env[])
其中第二种情况是合法的, 但不常见, 因为在程序中很少有只用argc, 而不
用argv[]的情况。
函数名: matherr
功 能: 用户可修改的数学错误处理程序
用 法: int matherr(struct exception *e);
函数名: memccpy
功 能: 从源source中拷贝n个字节到目标destin中
用 法: void *memccpy(void *destin, void *source, unsigned char ch,
unsigned n);
函数名: malloc
功 能: 内存分配函数
用 法: void *malloc(unsigned size);
函数名: memchr
功 能: 在数组的前n个字节中搜索字符
用 法: void *memchr(void *s, char ch, unsigned n);
函数名: memcpy
功 能: 从源source中拷贝n个字节到目标destin中
用 法: void *memcpy(void *destin, void *source, unsigned n);
函数名: memicmp
功 能: 比较两个串s1和s2的前n个字节, 忽略大小写
用 法: int memicmp(void *s1, void *s2, unsigned n);
函数名: memmove
功 能: 移动一块字节
用 法: void *memmove(void *destin, void *source, unsigned n);
展开阅读全文