韩冰 发表于 2004-10-4 03:02

函数大全(c开头)

<P align=center><FONT color=#0000ff size=3><B><FONT color=#cc0000>函数大全(c开头)</FONT></B></FONT>
</P>
<P><FONT color=#ff0000>函数名: cabs </FONT>
功 能: 计算复数的绝对值
用 法: double cabs(struct complex z);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <MATH.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
struct complex z;
double val; </FONT></P>
<P><FONT color=#0000ff>z.x = 2.0;
z.y = 1.0;
val = cabs(z); </FONT></P>
<P><FONT color=#0000ff>printf("The absolute value of %.2lfi %.2lfj is %.2lf", z.x, z.y, val);
return 0;
} </FONT>


</P>
<P><FONT color=#ff0000>函数名: calloc </FONT>
功 能: 分配主存储器
用 法: void *calloc(size_t nelem, size_t elsize);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <ALLOC.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
char *str = NULL; </FONT></P>
<P><FONT color=#0000ff>/* allocate memory for string */
str = calloc(10, sizeof(char)); </FONT></P>
<P><FONT color=#0000ff>/* copy "Hello" into string */
strcpy(str, "Hello"); </FONT></P>
<P><FONT color=#0000ff>/* display string */
printf("String is %s\n", str); </FONT></P>
<P><FONT color=#0000ff>/* free memory */
free(str); </FONT></P>
<P><FONT color=#0000ff>return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: ceil </FONT>
功 能: 向上舍入
用 法: double ceil(double x);
程序例: </P>
<P><FONT color=#0000ff>#include <MATH.H>
#include <STDIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
double number = 123.54;
double down, up; </FONT></P>
<P><FONT color=#0000ff>down = floor(number);
up = ceil(number); </FONT></P>
<P><FONT color=#0000ff>printf("original number %5.2lf\n", number);
printf("number rounded down %5.2lf\n", down);
printf("number rounded up %5.2lf\n", up); </FONT></P>
<P><FONT color=#0000ff>return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: cgets </FONT>
功 能: 从控制台读字符串
用 法: char *cgets(char *str);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
char buffer;
char *p; </FONT></P>
<P><FONT color=#0000ff>/* There's space for 80 characters plus the NULL terminator */
buffer = 81; </FONT></P>
<P><FONT color=#0000ff>printf("Input some chars:");
p = cgets(buffer);
printf("\ncgets read %d characters: \"%s\"\n", buffer, p);
printf("The returned pointer is %p, buffer is at %p\n", p, &amp;buffer); </FONT></P>
<P><FONT color=#0000ff>/* Leave room for 5 characters plus the NULL terminator */
buffer = 6; </FONT></P>
<P><FONT color=#0000ff>printf("Input some chars:");
p = cgets(buffer);
printf("\ncgets read %d characters: \"%s\"\n", buffer, p);
printf("The returned pointer is %p, buffer is at %p\n", p, &amp;buffer);
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: chdir </FONT>
功 能: 改变工作目录
用 法: int chdir(const char *path);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <STDLIB.H>
#include <DIR.H></FONT></P>
<P><FONT color=#0000ff>char old_dir;
char new_dir; </FONT></P>
<P><FONT color=#0000ff>int main(void)
{
if (getcurdir(0, old_dir))
{
perror("getcurdir()");
exit(1);
}
printf("Current directory is: \\%s\n", old_dir); </FONT></P>
<P><FONT color=#0000ff>if (chdir("\\"))
{
perror("chdir()");
exit(1);
} </FONT></P>
<P><FONT color=#0000ff>if (getcurdir(0, new_dir))
{
perror("getcurdir()");
exit(1);
}
printf("Current directory is now: \\%s\n", new_dir); </FONT></P>
<P><FONT color=#0000ff>printf("\nChanging back to orignal directory: \\%s\n", old_dir);
if (chdir(old_dir))
{
perror("chdir()");
exit(1);
} </FONT></P>
<P><FONT color=#0000ff>return 0;
}

</FONT></P>
<P><FONT color=#ff0000>函数名: _chmod, chmod </FONT>
功 能: 改变文件的访问方式
用 法: int chmod(const char *filename, int permiss);
程序例: </P>
<P><FONT color=#0000ff>#include <SYS\STAT.H>
#include <STDIO.H>
#include <IO.H></FONT></P>
<P><FONT color=#0000ff>void make_read_only(char *filename); </FONT></P>
<P><FONT color=#0000ff>int main(void)
{
make_read_only("NOTEXIST.FIL");
make_read_only("MYFILE.FIL");
return 0;
} </FONT></P>
<P><FONT color=#0000ff>void make_read_only(char *filename)
{
int stat; </FONT></P>
<P><FONT color=#0000ff>stat = chmod(filename, S_IREAD);
if (stat)
printf("Couldn't make %s read-only\n", filename);
else
printf("Made %s read-only\n", filename);
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: chsize </FONT>
功 能: 改变文件大小
用 法: int chsize(int handle, long size);
程序例: </P>
<P><FONT color=#0000ff>#include <STRING.H>
#include <FCNTL.H>
#include <IO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
int handle;
char buf = "0123456789"; </FONT></P>
<P><FONT color=#0000ff>/* create text file containing 10 bytes */
handle = open("DUMMY.FIL", O_CREAT);
write(handle, buf, strlen(buf)); </FONT></P>
<P><FONT color=#0000ff>/* truncate the file to 5 bytes in size */
chsize(handle, 5); </FONT></P>
<P><FONT color=#0000ff>/* close the file */
close(handle);
return 0;
}
</FONT>
</P>
<P><FONT color=#ff0000>函数名: circle </FONT>
功 能: 在给定半径以(x, y)为圆心画圆
用 法: void far circle(int x, int y, int radius);
程序例: </P>
<P><FONT color=#0000ff>#include <GRAPHICS.H>
#include <STDLIB.H>
#include <STDIO.H>
#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int radius = 100; </FONT></P>
<P><FONT color=#0000ff>/* initialize graphics and local variables */
initgraph(&amp;gdriver, &amp;gmode, ""); </FONT></P>
<P><FONT color=#0000ff>/* 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 */
} </FONT></P>
<P><FONT color=#0000ff>midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor()); </FONT></P>
<P><FONT color=#0000ff>/* draw the circle */
circle(midx, midy, radius); </FONT></P>
<P><FONT color=#0000ff>/* clean up */
getch();
closegraph();
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: cleardevice </FONT>
功 能: 清除图形屏幕
用 法: void far cleardevice(void);
程序例: </P>
<P><FONT color=#0000ff>#include <GRAPHICS.H>
#include <STDLIB.H>
#include <STDIO.H>
#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy; </FONT></P>
<P><FONT color=#0000ff>/* initialize graphics and local variables */
initgraph(&amp;gdriver, &amp;gmode, ""); </FONT></P>
<P><FONT color=#0000ff>/* 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 */
} </FONT></P>
<P><FONT color=#0000ff>midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor()); </FONT></P>
<P><FONT color=#0000ff>/* for centering screen messages */
settextjustify(CENTER_TEXT, CENTER_TEXT); </FONT></P>
<P><FONT color=#0000ff>/* output a message to the screen */
outtextxy(midx, midy, "press any key to clear the screen:"); </FONT></P>
<P><FONT color=#0000ff>/* wait for a key */
getch(); </FONT></P>
<P><FONT color=#0000ff>/* clear the screen */
cleardevice(); </FONT></P>
<P><FONT color=#0000ff>/* output another message */
outtextxy(midx, midy, "press any key to quit:"); </FONT></P>
<P><FONT color=#0000ff>/* clean up */
getch();
closegraph();
return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: clearerr </FONT>
功 能: 复位错误标志
用 法:void clearerr(FILE *stream);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
FILE *fp;
char ch; </FONT></P>
<P><FONT color=#0000ff>/* open a file for writing */
fp = fopen("DUMMY.FIL", "w"); </FONT></P>
<P><FONT color=#0000ff>/* force an error condition by attempting to read */
ch = fgetc(fp);
printf("%c\n",ch); </FONT></P>
<P><FONT color=#0000ff>if (ferror(fp))
{
/* display an error message */
printf("Error reading from DUMMY.FIL\n"); </FONT></P>
<P><FONT color=#0000ff>/* reset the error and EOF indicators */
clearerr(fp);
} </FONT></P>
<P><FONT color=#0000ff>fclose(fp);
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: clearviewport </FONT>
功 能: 清除图形视区
用 法: void far clearviewport(void);
程序例: </P>
<P><FONT color=#0000ff>#include <GRAPHICS.H>
#include <STDLIB.H>
#include <STDIO.H>
#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>#define CLIP_ON 1 /* activates clipping in viewport */ </FONT></P>
<P><FONT color=#0000ff>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int ht; </FONT></P>
<P><FONT color=#0000ff>/* initialize graphics and local variables */
initgraph(&amp;gdriver, &amp;gmode, ""); </FONT></P>
<P><FONT color=#0000ff>/* 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 */
} </FONT></P>
<P><FONT color=#0000ff>setcolor(getmaxcolor());
ht = textheight("W"); </FONT></P>
<P><FONT color=#0000ff>/* message in default full-screen viewport */
outtextxy(0, 0, "* &lt;-- (0, 0) in default viewport"); </FONT></P>
<P><FONT color=#0000ff>/* create a smaller viewport */
setviewport(50, 50, getmaxx()-50, getmaxy()-50, CLIP_ON); </FONT></P>
<P><FONT color=#0000ff>/* display some messages */
outtextxy(0, 0, "* &lt;-- (0, 0) in smaller viewport");
outtextxy(0, 2*ht, "Press any key to clear viewport:"); </FONT></P>
<P><FONT color=#0000ff>/* wait for a key */
getch(); </FONT></P>
<P><FONT color=#0000ff>/* clear the viewport */
clearviewport(); </FONT></P>
<P><FONT color=#0000ff>/* output another message */
outtextxy(0, 0, "Press any key to quit:"); </FONT></P>
<P><FONT color=#0000ff>/* clean up */
getch();
closegraph();
return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: _close, close </FONT>
功 能: 关闭文件句柄
用 法: int close(int handle);
程序例: </P>
<P><FONT color=#0000ff>#include <STRING.H>
#include <STDIO.H>
#include <FCNTL.H>
#include <IO.H></FONT></P>
<P><FONT color=#0000ff>main()
{
int handle;
char buf = "0123456789"; </FONT></P>
<P><FONT color=#0000ff>/* create a file containing 10 bytes */
handle = open("NEW.FIL", O_CREAT);
if (handle &gt; -1)
{
write(handle, buf, strlen(buf)); </FONT></P>
<P><FONT color=#0000ff>/* close the file */
close(handle);
}
else
{
printf("Error opening file\n");
}
return 0;
}


</FONT></P>
<P><FONT color=#ff0000>函数名: clock </FONT>
功 能: 确定处理器时间
用 法: clock_t clock(void);
程序例: </P>
<P><FONT color=#0000ff>#include <TIME.H>
#include <STDIO.H>
#include <DOS.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
clock_t start, end;
start = clock(); </FONT></P>
<P><FONT color=#0000ff>delay(2000); </FONT></P>
<P><FONT color=#0000ff>end = clock();
printf("The time was: %f\n", (end - start) / CLK_TCK); </FONT></P>
<P><FONT color=#0000ff>return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: closegraph </FONT>
功 能: 关闭图形系统
用 法: void far closegraph(void);
程序例: </P>
<P><FONT color=#0000ff>#include <GRAPHICS.H>
#include <STDLIB.H>
#include <STDIO.H>
#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int x, y; </FONT></P>
<P><FONT color=#0000ff>/* initialize graphics mode */
initgraph(&amp;gdriver, &amp;gmode, ""); </FONT></P>
<P><FONT color=#0000ff>/* read result of initialization */
errorcode = graphresult(); </FONT></P>
<P><FONT color=#0000ff>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 */
} </FONT></P>
<P><FONT color=#0000ff>x = getmaxx() / 2;
y = getmaxy() / 2; </FONT></P>
<P><FONT color=#0000ff>/* output a message */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(x, y, "Press a key to close the graphics system:"); </FONT></P>
<P><FONT color=#0000ff>/* wait for a key */
getch(); </FONT></P>
<P><FONT color=#0000ff>/* closes down the graphics system */
closegraph(); </FONT></P>
<P><FONT color=#0000ff>printf("We're now back in text mode.\n");
printf("Press any key to halt:");
getch();
return 0;
} </FONT>


</P>
<P><FONT color=#ff0000>函数名: clreol </FONT>
功 能: 在文本窗口中清除字符到行末
用 法: void clreol(void);
程序例: </P>
<P><FONT color=#0000ff>#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void) </FONT></P>
<P><FONT color=#0000ff>{
clrscr();
cprintf("The function CLREOL clears all characters from the\r\n");
cprintf("cursor position to the end of the line within the\r\n");
cprintf("current text window, without moving the cursor.\r\n");
cprintf("Press any key to continue . . .");
gotoxy(14, 4);
getch(); </FONT></P>
<P><FONT color=#0000ff>clreol();
getch(); </FONT></P>
<P><FONT color=#0000ff>return 0;
}


</FONT></P>
<P><FONT color=#0000ff>函数名: clrscr
功 能: 清除文本模式窗口
用 法: void clrscr(void);
程序例: </FONT></P>
<P><FONT color=#0000ff>#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
int i; </FONT></P>
<P><FONT color=#0000ff>clrscr();
for (i = 0; i &lt; 20; i++)
cprintf("%d\r\n", i);
cprintf("\r\nPress any key to clear screen");
getch(); </FONT></P>
<P><FONT color=#0000ff>clrscr();
cprintf("The screen has been cleared!");
getch(); </FONT></P>
<P><FONT color=#0000ff>return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: coreleft </FONT>
功 能: 返回未使用内存的大小
用 法: unsigned coreleft(void);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <ALLOC.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
printf("The difference between the highest allocated block and\n");
printf("the top of the heap is: %lu bytes\n", (unsigned long) coreleft()); </FONT></P>
<P><FONT color=#0000ff>return 0;
} </FONT>
</P>
<P><FONT color=#ff0000>函数名: cos </FONT>
功 能: 余弦函数
用 法: double cos(double x);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <MATH.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
double result;
double x = 0.5; </FONT></P>
<P><FONT color=#0000ff>result = cos(x);
printf("The cosine of %lf is %lf\n", x, result);
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: cosh </FONT>
功 能: 双曲余弦函数
用 法: dluble cosh(double x);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <MATH.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
double result;
double x = 0.5; </FONT></P>
<P><FONT color=#0000ff>result = cosh(x);
printf("The hyperboic cosine of %lf is %lf\n", x, result);
return 0;
} </FONT>


</P>
<P><FONT color=#ff0000>函数名: country </FONT>
功 能: 返回与国家有关的信息
用 法: struct COUNTRY *country(int countrycode, struct country *country);
程序例: </P>
<P><FONT color=#0000ff>#include <DOS.H>
#include <STDIO.H></FONT></P>
<P><FONT color=#0000ff>#define USA 0 </FONT></P>
<P><FONT color=#0000ff>int main(void)
{
struct COUNTRY country_info; </FONT></P>
<P><FONT color=#0000ff>country(USA, &amp;country_info);
printf("The currency symbol for the USA is: %s\n",
country_info.co_curr);
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: cprintf </FONT>
功 能: 送格式化输出至屏幕
用 法: int cprintf(const char *format[, argument, ...]);
程序例: </P>
<P><FONT color=#0000ff>#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
/* clear the screen */
clrscr(); </FONT></P>
<P><FONT color=#0000ff>/* create a text window */
window(10, 10, 80, 25); </FONT></P>
<P><FONT color=#0000ff>/* output some text in the window */
cprintf("Hello world\r\n"); </FONT></P>
<P><FONT color=#0000ff>/* wait for a key */
getch();
return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: cputs </FONT>
功 能: 写字符到屏幕
用 法: void cputs(const char *string);
程序例: </P>
<P><FONT color=#0000ff>#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
/* clear the screen */
clrscr(); </FONT></P>
<P><FONT color=#0000ff>/* create a text window */
window(10, 10, 80, 25); </FONT></P>
<P><FONT color=#0000ff>/* output some text in the window */
cputs("This is within the window\r\n"); </FONT></P>
<P><FONT color=#0000ff>/* wait for a key */
getch();
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: _creat creat </FONT>
功 能: 创建一个新文件或重写一个已存在的文件
用 法: int creat (const char *filename, int permiss);
程序例: </P>
<P><FONT color=#0000ff>#include <SYS\STAT.H>
#include <STRING.H>
#include <FCNTL.H>
#include <IO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
int handle;
char buf = "0123456789"; </FONT></P>
<P><FONT color=#0000ff>/* change the default file mode from text to binary */
_fmode = O_BINARY; </FONT></P>
<P><FONT color=#0000ff>/* create a binary file for reading and writing */
handle = creat("DUMMY.FIL", S_IREAD | S_IWRITE); </FONT></P>
<P><FONT color=#0000ff>/* write 10 bytes to the file */
write(handle, buf, strlen(buf)); </FONT></P>
<P><FONT color=#0000ff>/* close the file */
close(handle);
return 0;
} </FONT>
</P>
<P><FONT color=#ff0000>函数名: creatnew </FONT>
功 能: 创建一个新文件
用 法: int creatnew(const char *filename, int attrib);
程序例: </P>
<P><FONT color=#0000ff>#include <STRING.H>
#include <STDIO.H>
#include <ERRNO.H>
#include <DOS.H>
#include <IO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
int handle;
char buf = "0123456789"; </FONT></P>
<P><FONT color=#0000ff>/* attempt to create a file that doesn't already exist */
handle = creatnew("DUMMY.FIL", 0); </FONT></P>
<P><FONT color=#0000ff>if (handle == -1)
printf("DUMMY.FIL already exists.\n");
else
{
printf("DUMMY.FIL successfully created.\n");
write(handle, buf, strlen(buf));
close(handle);
}
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: creattemp </FONT>
功 能: 创建一个新文件或重写一个已存在的文件
用 法: int creattemp(const char *filename, int attrib);
程序例: </P>
<P><FONT color=#0000ff>#include <STRING.H>
#include <STDIO.H>
#include <IO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
int handle;
char pathname; </FONT></P>
<P><FONT color=#0000ff>strcpy(pathname, "\\"); </FONT></P>
<P><FONT color=#0000ff>/* create a unique file in the root directory */
handle = creattemp(pathname, 0); </FONT></P>
<P><FONT color=#0000ff>printf("%s was the unique file created.\n", pathname);
close(handle);
return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: cscanf </FONT>
功 能: 从控制台执行格式化输入
用 法: int cscanf(char *format[,argument, ...]);
程序例: </P>
<P><FONT color=#0000ff>#include <CONIO.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
char string; </FONT></P>
<P><FONT color=#0000ff>/* clear the screen */
clrscr(); </FONT></P>
<P><FONT color=#0000ff>/* Prompt the user for input */
cprintf("Enter a string with no spaces:"); </FONT></P>
<P><FONT color=#0000ff>/* read the input */
cscanf("%s", string); </FONT></P>
<P><FONT color=#0000ff>/* display what was read */
cprintf("\r\nThe string entered is: %s", string);
return 0;
}

</FONT>
</P>
<P><FONT color=#ff0000>函数名: ctime </FONT>
功 能: 把日期和时间转换为字符串
用 法: char *ctime(const time_t *time);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <TIME.H></FONT></P>
<P><FONT color=#0000ff>int main(void)
{
time_t t; </FONT></P>
<P><FONT color=#0000ff>time(&amp;t);
printf("Today's date and time: %s\n", ctime(&amp;t));
return 0;
}
</FONT>

</P>
<P><FONT color=#ff0000>函数名: ctrlbrk </FONT>
功 能: 设置Ctrl-Break处理程序
用 法: void ctrlbrk(*fptr)(void);
程序例: </P>
<P><FONT color=#0000ff>#include <STDIO.H>
#include <DOS.H></FONT></P>
<P><FONT color=#0000ff>#define ABORT 0 </FONT></P>
<P><FONT color=#0000ff>int c_break(void)
{
printf("Control-Break pressed. Program aborting ...\n");
return (ABORT);
} </FONT></P>
<P><FONT color=#0000ff>int main(void)
{
ctrlbrk(c_break);
for(;;)
{
printf("Looping... Press <CTRL-BREAK>to quit:\n");
}
return 0;
} </FONT></P>

zjf 发表于 2005-3-20 20:26

<P></P><P>谢谢啊</P>

chenlk 发表于 2005-4-9 16:39

有价值!

xxb1922 发表于 2005-4-23 20:12

这样看太痛苦了,还不如去下载一个专门查函数的软件,我就有一个

xxb1922 发表于 2005-4-23 20:13

这样看太痛苦了,还不如去下载一个专门查函数的软件,我就有一个

gssdzc 发表于 2010-6-14 13:02

还是感谢分享。。。

hjl19890710hjl 发表于 2011-10-19 15:24

特别感谢{:soso_e100:}
页: [1]
查看完整版本: 函数大全(c开头)