?? b.htm
字號(hào):
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body bgcolor="#00FFFF" text="#000080">
<PRE><font size="5"><a href="a.htm">A</a> <a href="b.htm">B</a> <a href="c.htm">C</a> <a href="d.htm">D</a> <a href="e.htm">E</a> <a href="f.htm">F</a> <a href="g.htm">G</a> <a href="h.htm">H</a> <a href="i.htm">I</a> <a href="k.htm">K</a> <a href="l.htm">L</a> <a href="m.htm">M</a> <a href="n.htm">N</a> <a href="o.htm">O</a> <a href="p.htm">P</a> <a href="q.htm">Q</a> <a href="r.htm">R</a> <a href="s.htm">S</a> <a href="t.htm">T</a> <a href="u.htm">U</a> <a href="v.htm">V</a> <a href="w.htm">W</a> </font></PRE>
<PRE>函數(shù)大全(b開頭)</PRE>
<PRE>函數(shù)名: <font size="5" color="#FF0000">bar</font>
功 能: 畫一個(gè)二維條形圖
用 法: void far bar(int left, int top, int right, int bottom);
程序例: </PRE>
<PRE>#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy, i; </PRE>
<PRE>/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, ""); </PRE>
<PRE>/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
} </PRE>
<PRE>midx = getmaxx() / 2;
midy = getmaxy() / 2; </PRE>
<PRE>/* loop through the fill patterns */
for (i=SOLID_FILL; i {
/* set the fill style */
setfillstyle(i, getmaxcolor()); </PRE>
<PRE>/* draw the bar */
bar(midx-50, midy-50, midx+50,
midy+50); </PRE>
<PRE>getch();
} </PRE>
<PRE>/* clean up */
closegraph();
return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> bar3d </font>
功 能: 畫一個(gè)三維條形圖
用 法: void far bar3d(int left, int top, int right, int bottom,
int depth, int topflag);
程序例: </PRE>
<PRE>#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy, i; </PRE>
<PRE>/* initialize graphics, local variables */
initgraph(&gdriver, &gmode, ""); </PRE>
<PRE>/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with error code */
} </PRE>
<PRE>midx = getmaxx() / 2;
midy = getmaxy() / 2; </PRE>
<PRE>/* loop through the fill patterns */
for (i=EMPTY_FILL; i {
/* set the fill style */
setfillstyle(i, getmaxcolor()); </PRE>
<PRE>/* draw the 3-d bar */
bar3d(midx-50, midy-50, midx+50, midy+50, 10, 1); </PRE>
<PRE>getch();
} </PRE>
<PRE>/* clean up */
closegraph();
return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> bdos</font>
功 能: DOS系統(tǒng)調(diào)用
用 法: int bdos(int dosfun, unsigned dosdx, unsigned dosal);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>/* Get current drive as 'A', 'B', ... */
char current_drive(void)
{
char curdrive; </PRE>
<PRE>/* Get current disk as 0, 1, ... */
curdrive = bdos(0x19, 0, 0);
return('A' + curdrive);
} </PRE>
<PRE>int main(void)
{
printf("The current drive is %c:\n", current_drive());
return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> bdosptr </font>
功 能: DOS系統(tǒng)調(diào)用
用 法: int bdosptr(int dosfun, void *argument, unsigned dosal);
程序例: </PRE>
<PRE>#include
#include
#include
#include
#include
#include </PRE>
<PRE>#define BUFLEN 80 </PRE>
<PRE>int main(void)
{
char buffer[BUFLEN];
int test; </PRE>
<PRE>printf("Enter full pathname of a directory\n");
gets(buffer); </PRE>
<PRE>test = bdosptr(0x3B,buffer,0);
if(test)
{
printf("DOS error message: %d\n", errno);
/* See errno.h for error listings */
exit (1);
} </PRE>
<PRE>getcwd(buffer, BUFLEN);
printf("The current directory is: %s\n", buffer); </PRE>
<PRE>return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> bioscom </font>
功 能: 串行I/O通信
用 法: int bioscom(int cmd, char abyte, int port);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>#define COM1 0
#define DATA_READY 0x100
#define TRUE 1
#define FALSE 0 </PRE>
<PRE>#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00) </PRE>
<PRE>int main(void)
{
int in, out, status, DONE = FALSE; </PRE>
<PRE>bioscom(0, SETTINGS, COM1);
cprintf("... BIOSCOM [ESC] to exit ...\n");
while (!DONE)
{
status = bioscom(3, 0, COM1);
if (status & DATA_READY)
if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)
putch(out);
if (kbhit())
{
if ((in = getch()) == '\x1B')
DONE = TRUE;
bioscom(1, in, COM1);
}
}
return 0;
}
</PRE>
<PRE>函數(shù)名: <font size="5" color="#FF0000">biosdisk </font>
功 能: 軟硬盤I/O
用 法: int biosdisk(int cmd, int drive, int head, int track, int sector
int nsects, void *buffer);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
int result;
char buffer[512]; </PRE>
<PRE>printf("Testing to see if drive a: is ready\n");
result = biosdisk(4,0,0,0,0,1,buffer);
result &= 0x02;
(result) ? (printf("Drive A: Ready\n")) :
(printf("Drive A: Not Ready\n")); </PRE>
<PRE>return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> biosequip </font>
功 能: 檢查設(shè)備
用 法: int biosequip(void);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
int result;
char buffer[512]; </PRE>
<PRE>printf("Testing to see if drive a: is ready\n");
result = biosdisk(4,0,0,0,0,1,buffer);
result &= 0x02;
(result) ? (printf("Drive A: Ready\n")) :
(printf("Drive A: Not Ready\n")); </PRE>
<PRE>return 0;
}
</PRE>
<PRE>函數(shù)名: <font size="5" color="#FF0000">bioskey </font>
功 能: 直接使用BIOS服務(wù)的鍵盤接口
用 法: int bioskey(int cmd);
程序例: </PRE>
<PRE>#include
#include
#include </PRE>
<PRE>#define RIGHT 0x01
#define LEFT 0x02
#define CTRL 0x04
#define ALT 0x08 </PRE>
<PRE>int main(void)
{
int key, modifiers; </PRE>
<PRE>/* function 1 returns 0 until a key is pressed */
while (bioskey(1) == 0); </PRE>
<PRE>/* function 0 returns the key that is waiting */
key = bioskey(0); </PRE>
<PRE>/* use function 2 to determine if shift keys were used */
modifiers = bioskey(2);
if (modifiers)
{
printf("[");
if (modifiers & RIGHT) printf("RIGHT");
if (modifiers & LEFT) printf("LEFT");
if (modifiers & CTRL) printf("CTRL");
if (modifiers & ALT) printf("ALT");
printf("]");
}
/* print out the character read */
if (isalnum(key & 0xFF))
printf("'%c'\n", key);
else
printf("%#02x\n", key);
return 0;
}
</PRE>
<PRE>函數(shù)名: <font size="5" color="#FF0000">biosmemory </font>
功 能: 返回存儲(chǔ)塊大小
用 法:int biosmemory(void);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
int memory_size; </PRE>
<PRE>memory_size = biosmemory(); /* returns value up to 640K */
printf("RAM size = %dK\n",memory_size);
return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> biosprint </font>
功 能: 直接使用BIOS服務(wù)的打印機(jī)I/O
用 法: int biosprint(int cmd, int byte, int port);
程序例: </PRE>
<PRE>#include
#include
#include </PRE>
<PRE>int main(void)
{
#define STATUS 2 /* printer status command */
#define PORTNUM 0 /* port number for LPT1 */ </PRE>
<PRE>int status, abyte=0; </PRE>
<PRE>printf("Please turn off your printer. Press any key to continue\n");
getch();
status = biosprint(STATUS, abyte, PORTNUM);
if (status & 0x01)
printf("Device time out.\n");
if (status & 0x08)
printf("I/O error.\n"); </PRE>
<PRE>if (status & 0x10)
printf("Selected.\n");
if (status & 0x20)
printf("Out of paper.\n"); </PRE>
<PRE>if (status & 0x40)
printf("Acknowledge.\n");
if (status & 0x80)
printf("Not busy.\n"); </PRE>
<PRE>return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> biostime </font>
功 能: 讀取或設(shè)置BIOS時(shí)間
用 法: long biostime(int cmd, long newtime);
程序例: </PRE>
<PRE>#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
long bios_time; </PRE>
<PRE>clrscr();
cprintf("The number of clock ticks since midnight is:\r\n");
cprintf("The number of seconds since midnight is:\r\n");
cprintf("The number of minutes since midnight is:\r\n");
cprintf("The number of hours since midnight is:\r\n");
cprintf("\r\nPress any key to quit:");
while(!kbhit())
{
bios_time = biostime(0, 0L); </PRE>
<PRE>gotoxy(50, 1);
cprintf("%lu", bios_time); </PRE>
<PRE>gotoxy(50, 2);
cprintf("%.4f", bios_time / CLK_TCK); </PRE>
<PRE>gotoxy(50, 3);
cprintf("%.4f", bios_time / CLK_TCK / 60); </PRE>
<PRE>gotoxy(50, 4);
cprintf("%.4f", bios_time / CLK_TCK / 3600);
}
return 0;
}
</PRE>
<PRE>函數(shù)名: <font size="5" color="#FF0000">brk</font>
功 能: 改變數(shù)據(jù)段空間分配
用 法: int brk(void *endds);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
char *ptr; </PRE>
<PRE>printf("Changing allocation with brk()\n");
ptr = malloc(1);
printf("Before brk() call: %lu bytes free\n", coreleft());
brk(ptr+1000);
printf(" After brk() call: %lu bytes free\n", coreleft());
return 0;
}
</PRE>
<PRE>函數(shù)名:<font size="5" color="#FF0000"> bsearch</font>
功 能: 二分法搜索
用 法: void *bsearch(const void *key, const void *base, size_t *nelem,
size_t width, int(*fcmp)(const void *, const *));
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0])) </PRE>
<PRE>int numarray[] = {123, 145, 512, 627, 800, 933}; </PRE>
<PRE>int numeric (const int *p1, const int *p2)
{
return(*p1 - *p2);
} </PRE>
<PRE>int lookup(int key)
{
int *itemptr; </PRE>
<PRE>/* The cast of (int(*)(const void *,const void*)) is needed to avoid a type mismatch error at compile time */
</PRE>
<PRE>itemptr = bsearch (&key, numarray, NELEMS(numarray),
sizeof(int), (int(*)(const void *,const void *))numeric);
return (itemptr != NULL);
} </PRE>
<PRE>int main(void)
{
if (lookup(512))
printf("512 is in the table.\n");
else
printf("512 isn't in the table.\n"); </PRE>
<PRE>return 0;
}
</PRE>
<PRE><font size="5"><a href="a.htm">A</a> <a href="b.htm">B</a> <a href="c.htm">C</a> <a href="d.htm">D</a> <a href="e.htm">E</a> <a href="f.htm">F</a> <a href="g.htm">G</a> <a href="h.htm">H</a> <a href="i.htm">I</a> <a href="k.htm">K</a> <a href="l.htm">L</a> <a href="m.htm">M</a> <a href="n.htm">N</a> <a href="o.htm">O</a> <a href="p.htm">P</a> <a href="q.htm">Q</a> <a href="r.htm">R</a> <a href="s.htm">S</a> <a href="t.htm">T</a> <a href="u.htm">U</a> <a href="v.htm">V</a> <a href="w.htm">W</a> </font></PRE>
<pre> </pre>
<pre> </pre>
<pre>資料收集:beck Copyright 2004 張求熙, All Rights Reserved</pre>
<pre><a href="mailto:Email:qiuxi1984@126.com">Email:qiuxi1984@126.com</a> QQ:35540948 </pre>
<PRE> </PRE>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -