C语言函数大全-E篇

上传人:20****03 文档编号:178994170 上传时间:2021-04-06 格式:DOC 页数:5 大小:18KB
返回 下载 相关 举报
C语言函数大全-E篇_第1页
第1页 / 共5页
C语言函数大全-E篇_第2页
第2页 / 共5页
C语言函数大全-E篇_第3页
第3页 / 共5页
C语言函数大全-E篇_第4页
第4页 / 共5页
C语言函数大全-E篇_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《C语言函数大全-E篇》由会员分享,可在线阅读,更多相关《C语言函数大全-E篇(5页珍藏版)》请在金锄头文库上搜索。

1、E:函数名: ecvt功 能: 把一个浮点数转换为字符串用 法: char ecvt(double value, int ndigit, int *decpt, int *sign);程序例: #include #include #include int main(void) char *string; double value; int dec, sign; int ndig = 10; clrscr(); value = 9.876; string = ecvt(value, ndig, &dec, &sign); printf(string = %s dec = %d sign = %d

2、n, string, dec, sign); value = -123.45; ndig= 15; string = ecvt(value,ndig,&dec,&sign); printf(string = %s dec = %d sign = %dn, string, dec, sign); value = 0.6789e5; /* scientific notation */ ndig = 5; string = ecvt(value,ndig,&dec,&sign); printf(string = %s dec = %d sign = %dn, string, dec, sign);

3、return 0;函数名: ellipse功 能: 画一椭圆用 法: void far ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);程序例:#include #include #include #include int main(void) /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; int stangle = 0, endangle = 360; int xrad

4、ius = 100, yradius = 50; /* initialize graphics, local variables */ initgraph(&gdriver, &gmode, ); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch

5、(); exit(1); /* terminate with an error code */ midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxcolor(); /* draw ellipse */ ellipse(midx, midy, stangle, endangle, xradius, yradius); /* clean up */ getch(); closegraph(); return 0;函数名: enable功 能: 开放硬件中断用 法: void enable(void);程序例:/* * NOTE:T

6、his is an interrupt service routine. You can NOT compile this programwith Test Stack Overflow turned on and get an executable file which willoperate correctly.*/#include #include #include /* The clock tick interrupt */#define INTR 0X1Cvoid interrupt ( *oldhandler)(void);int count=0;void interrupt ha

7、ndler(void)/* disable interrupts during the handling of the interrupt*/ disable();/* increase the global counter */ count+;/* re enable interrupts at the end of the handler*/ enable();/* call the old routine */ oldhandler();int main(void)/* save the old interrupt vector */ oldhandler = getvect(INTR)

8、;/* install the new interrupt handler */ setvect(INTR, handler);/* loop until the counter exceeds 20 */ while (count 20) printf(count is %dn,count);/* reset the old interrupt handler */ setvect(INTR, oldhandler); return 0;函数名: exec.功 能: 装入并运行其它程序的函数用 法: int execl(char *pathname, char *arg0, arg1, .,

9、 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 e

10、xecvp(char *pathname, char *argv);int execvpe(char *pathname, char *argv, char *envp);程序例:/* execv example */#include #include #include void main(int argc, char *argv) int i; printf(Command line arguments:n); for (i=0; iargc; i+) printf(%2d : %sn, i, argvi); printf(About to exec child with arg1 arg2 .n); execv(CHILD.EXE, argv); perror(exec error); exit(1);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 教学/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号