?? 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 which
will
<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 hit
EOF
<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 + -