📄 fe.htm
字号:
<HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"> <META NAME="Author" CONTENT="wdg"> <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (Win95; I) [Netscape]"> <TITLE>fe</TITLE></HEAD><BODY>函数名: ecvt<BR>功 能: 把一个浮点数转换为字符串<BR>用 法: char ecvt(double value, int ndigit, int *decpt, int *sign);<BR>程序例:<P>#include <stdlib.h><BR>#include <stdio.h><BR>#include <conio.h><P>int main(void)<BR>{<BR> char *string;<BR> double value;<BR> int dec, sign;<BR> int ndig = 10;<P> clrscr();<BR> value = 9.876;<BR> string = ecvt(value, ndig, &dec, &sign);<BR> printf("string = %s dec= %d \<BR> sign = %d\n", string, dec, sign);<P> value = -123.45;<BR> ndig= 15;<BR> string = ecvt(value,ndig,&dec,&sign);<BR> printf("string = %s dec = %d sign = %d\n",<BR> string, dec, sign);<BR> <P> value = 0.6789e5; /* scientific<BR> notation */<BR> ndig = 5;<BR> string = ecvt(value,ndig,&dec,&sign);<BR> printf("string = %s dec = %d\<BR> sign = %d\n", string, dec, sign);<P> return 0;<BR>}<BR> <BR> <P>函数名: ellipse<BR>功 能: 画一椭圆<BR>用 法: void far ellipse(int x, int y, int stangle, int endangle,<BR> int xradius, int yradius);<BR>程序例:<P>#include <graphics.h><BR>#include <stdlib.h><BR>#include <stdio.h><BR>#include <conio.h><P>int main(void)<BR>{<BR> /* request auto detection */<BR> int gdriver = DETECT, gmode, errorcode;<BR> int midx, midy;<BR> int stangle = 0, endangle = 360;<BR> int xradius = 100, yradius = 50;<P> /* initialize graphics, local variables */<BR> initgraph(&gdriver, &gmode, "");<P> /* read result of initialization */<BR> errorcode = graphresult();<BR> if (errorcode != grOk)<BR> /* an error occurred */<BR> {<BR> printf("Graphics error: %s\n",<BR> grapherrormsg(errorcode));<BR> printf("Press any key to halt:");<BR> getch();<BR> exit(1);<BR> /* terminate with an error code */<BR> }<P> midx = getmaxx() / 2;<BR> midy = getmaxy() / 2;<BR> setcolor(getmaxcolor());<P> /* draw ellipse */<BR> ellipse(midx, midy, stangle, endangle,<BR> xradius, yradius);<P> /* clean up */<BR> getch();<BR> closegraph();<BR> return 0;<BR>}<BR> <BR> <P>函数名: enable<BR>功 能: 开放硬件中断<BR>用 法: void enable(void);<BR>程序例:<P>/* ** NOTE:<BR>This is an interrupt service routine. You can NOT compile this program<BR>with Test Stack Overflow turned on and get an executable file whichwill<BR>operate correctly.<BR>*/<P>#include <stdio.h><BR>#include <dos.h><BR>#include <conio.h><P>/* The clock tick interrupt */<BR>#define INTR 0X1C<P>void interrupt ( *oldhandler)(void);<P>int count=0;<P>void interrupt handler(void)<BR>{<BR>/*<BR> disable interrupts during the handling of the interrupt<BR>*/<BR> disable();<BR>/* increase the global counter */<BR> count++;<BR>/*<BR> re enable interrupts at the end of the handler<BR>*/<BR> enable();<BR>/* call the old routine */<BR> oldhandler();<BR>}<P>int main(void)<BR>{<BR>/* save the old interrupt vector */<BR> oldhandler = getvect(INTR);<P>/* install the new interrupt handler */<BR> setvect(INTR, handler);<P>/* loop until the counter exceeds 20 */<BR> while (count < 20)<BR> printf("count is %d\n",count);<P>/* reset the old interrupt handler */<BR> setvect(INTR, oldhandler);<P> return 0;<BR>}<BR> <BR> <P>函数名: eof<BR>功 能: 检测文件结束<BR>用 法: int eof(int *handle);<BR>程序例:<P>#include <sys\stat.h><BR>#include <string.h><BR>#include <stdio.h><BR>#include <fcntl.h><BR>#include <io.h><P>int main(void)<BR>{<BR> int handle;<BR> char msg[] = "This is a test";<BR> char ch;<P> /* create a file */<BR> handle = open("DUMMY.FIL",<BR> O_CREAT | O_RDWR,<BR> S_IREAD | S_IWRITE);<P> /* write some data to the file */<BR> write(handle, msg, strlen(msg));<P> /* seek to the beginning of the file */<BR> lseek(handle, 0L, SEEK_SET);<P> /*<BR> reads chars from the file until hitEOF<BR> */<BR> do<BR> {<BR> read(handle, &ch, 1);<BR> printf("%c", ch);<BR> } while (!eof(handle));<P> close(handle);<BR> return 0;<BR>}<BR> <BR> <P>函数名: exec...<BR>功 能: 装入并运行其它程序的函数<BR>用 法: int execl(char *pathname, char *arg0, arg1, ..., argn,NULL);<BR> int execle(char *pathname, char *arg0, arg1, ..., argn, NULL,<BR> char *envp[]);<BR> int execlp(char *pathname, char *arg0, arg1, .., NULL);<BR> int execple(char *pathname, char *arg0, arg1, ..., NULL,<BR> char *envp[]);<BR> int execv(char *pathname, char *argv[]);<BR> int execve(char *pathname, char *argv[], char *envp[]);<BR> int execvp(char *pathname, char *argv[]);<BR> int execvpe(char *pathname, char *argv[], char *envp[]);<BR>程序例:<P>/* execv example */<BR>#include <process.h><BR>#include <stdio.h><BR>#include <errno.h><P>void main(int argc, char *argv[])<BR>{<BR> int i;<P> printf("Command line arguments:\n");<BR> for (i=0; i<argc; i++)<BR> printf("[%2d] : %s\n", i, argv[i]);<P> printf("About to exec child with arg1 arg2 ...\n");<BR> execv("CHILD.EXE", argv);<P> perror("exec error");<P> exit(1);<BR>}<BR> <BR> <P>函数名: exit<BR>功 能: 终止程序<BR>用 法: void exit(int status);<BR>程序例:<P>#include <stdlib.h><BR>#include <conio.h><BR>#include <stdio.h><P>int main(void)<BR>{<BR> int status;<P> printf("Enter either 1 or 2\n");<BR> status = getch();<BR> /* Sets DOS errorlevel */<BR> exit(status - '0');<P>/* Note: this line is never reached */<BR> return 0;<BR>}<BR> <BR> <P>函数名: exp<BR>功 能: 指数函数<BR>用 法: double exp(double x);<BR>程序例:<P>#include <stdio.h><BR>#include <math.h><P>int main(void)<BR>{<BR> double result;<BR> double x = 4.0;<P> result = exp(x);<BR> printf("'e' raised to the power \<BR> of %lf (e ^ %lf) = %lf\n",<BR> x, x, result);<P> return 0;<BR>}<BR> <P> <A HREF="index.html">返回目录</A><BR> </BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -