?? fo.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>fo</TITLE>
</HEAD>
<BODY>
<P>函數名: open
<BR>功 能: 打開一個文件用于讀或寫
<BR>用 法: int open(char *pathname, int access[, int permiss]);
<BR>程序例:
<P>#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[] = "Hello world";
<P> if ((handle = open("TEST.$$$", O_CREAT | O_TEXT)) == -1)
<BR> {
<BR> perror("Error:");
<BR> return 1;
<BR> }
<BR> write(handle, msg, strlen(msg));
<BR> close(handle);
<BR> return 0;
<BR>}
<BR>
<BR>
<P>函數名: outport
<BR>功 能: 輸出整數到硬件端口中
<BR>用 法: void outport(int port, int value);
<BR>程序例:
<P>#include <stdio.h>
<BR>#include <dos.h>
<P>int main(void)
<BR>{
<BR> int value = 64;
<BR> int port = 0;
<P> outportb(port, value);
<BR> printf("Value %d sent to port number %d\n", value, port);
<BR> return 0;
<BR>}
<BR>
<BR>
<P>函數名: outportb
<BR>功 能: 輸出字節到硬件端口中
<BR>用 法: void outportb(int port, char byte);
<BR>程序例:
<P>#include <stdio.h>
<BR>#include <dos.h>
<P>int main(void)
<BR>{
<BR> int value = 64;
<BR> int port = 0;
<P> outportb(port, value);
<BR> printf("Value %d sent to port number %d\n", value, port);
<BR> return 0;
<BR>}
<BR>
<BR>
<P>函數名: outtext
<BR>功 能: 在視區顯示一個字符串
<BR>用 法: void far outtext(char far *textstring);
<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;
<P> /* initialize graphics and local variables */
<BR> initgraph(&gdriver, &gmode, "");
<P> /* read result of initialization */
<BR> errorcode = graphresult();
<BR> if (errorcode != grOk) /* an error occurred */
<BR> {
<BR> printf("Graphics error: %s\n", grapherrormsg(errorcode));
<BR> printf("Press any key to halt:");
<BR> getch();
<BR> exit(1); /* terminate with an error
code */
<BR> }
<P> midx = getmaxx() / 2;
<BR> midy = getmaxy() / 2;
<P> /* move the C.P. to the center of the screen */
<BR> moveto(midx, midy);
<P> /* output text starting at the C.P. */
<BR> outtext("This ");
<BR> outtext("is ");
<BR> outtext("a ");
<BR> outtext("test.");
<P> /* clean up */
<BR> getch();
<BR> closegraph();
<BR> return 0;
<BR>}
<BR>
<BR>
<P>函數名: outtextxy
<BR>功 能: 在指定位置顯示一字符串
<BR>用 法: void far outtextxy(int x, int y, char *textstring);
<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;
<P> /* initialize graphics and local variables */
<BR> initgraph( &gdriver, &gmode, "");
<P> /* read result of initialization */
<BR> errorcode = graphresult();
<BR> if (errorcode != grOk) /* an error occurred */
<BR> {
<BR> printf("Graphics error: %s\n", grapherrormsg(errorcode));
<BR> printf("Press any key to halt:");
<BR> getch();
<BR> exit(1); /* terminate with an error
code */
<BR> }
<P> midx = getmaxx() / 2;
<BR> midy = getmaxy() / 2;
<P> /* output text at the center of the screen*/
<BR> /* Note: the C.P. doesn't get changed.*/
<BR> outtextxy(midx, midy, "This is a test.");
<P> /* clean up */
<BR> getch();
<BR> closegraph();
<BR> return 0;
<BR>}
<BR>
<P>
<A HREF="index.html">返回目錄</A>
<BR>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -