Turbo C 2.0、Borland C++库函数及用例(16) close(handle);return 0;}函数名: cscanf功 能: 从控制台执行格式化输入用 法: int cscanf(char *format[,argument, ...]);程序例:#include <conio.h>int main(void){char string[80]; /* clear the screen */clrscr();/* Prompt the user for input */cprintf("Enter a string with no spaces:"); /* read the input */cscanf("%s", string); /* display what was read */cprintf("\r\nThe string entered is: %s", string);return 0;}函数名: ctime功 能: 把日期和时间转换为字符串用 法: char *ctime(const time_t *time);程序例:#include <stdio.h>#include <time.h>int main(void){time_t t; time(&t);printf("Today's date and time: %s\n", ctime(&t)); return 0;}函数名: ctrlbrk功 能: 设置Ctrl-Break处理程序用 法: void ctrlbrk(*fptr)(void);程序例:#include <stdio.h>#include <dos.h>#define ABORT 0int c_break(void){printf("Control-Break pressed. Program aborting ...\n");return (ABORT);}int main(void){ctrlbrk(c_break);for(;;){ printf("Looping... Press <Ctrl-Break> to quit:\n");}return 0;}字母D开头函数函数名: delay功 能: 将程序的执行暂停一段时间(毫秒)用 法: void delay(unsigned milliseconds);程序例:/* Emits a 440-Hz tone for 500 milliseconds */#include <dos.h>int main(void){sound(440);delay(500);nosound();return 0;}函数名: delline功 能: 在文本窗口中删去一行用 法: void delline(void);程序例:#include <conio.h>int main(void){clrscr();cprintf("The function DELLINE deletes \the line containing the\r\n");cprintf("cursor and moves all lines \below it one line up.\r\n"); cprintf("DELLINE operates within the \currently active text\r\n");cprintf("window. Press any key to \continue . . .");gotoxy(1,2); /* Move the cursor to thesecond line and first column */getch();delline();getch(); return 0;}函数名: detectgraph功 能: 通过检测硬件确定图形驱动程序和模式用 法: void far detectgraph( int far *graphdriver,int far *graphmode);