[编程资料]C语言库函数大全及应用实例十四 函数名: strset 功 能: 将一个串中的所有字符都设为指定字符 用 法: char *strset(char *str, char c); 程序例: #i nclude int main(void) printf("Before strset(): %s\n", string); 函数名: strspn #i nclude int main(void) length = strspn(string1, string2); 函数名: strstr #i nclude int main(void) ptr = strstr(str1, str2); 函数名: strtod #i nclude int main(void) printf("Enter a floating point number:"); 函数名: strtok #i nclude int main(void) /* strtok places a NULL terminator /* A second call to strtok using a NULL 函数名: strtol #i nclude int main(void) /* strtol converts string to long integer */ return 0; 函数名: strupr #i nclude int main(void) /* converts string to upper case characters */ 函数名: swab #i nclude char source[15] = "rFna koBlrna d"; int main(void) 函数名: system #i nclude int main(void) 函数名: tan #i nclude int main(void) x = 0.5; 函数名: tanh #i nclude int main(void) x = 0.5; 函数名: tell #i nclude int main(void) if ((handle = open("TEST.$$$", O_CREAT | O_TEXT | O_APPEND)) == -1) 函数名: textattr #i nclude int main(void) clrscr(); return 0; 函数名: textbackground #i nclude int main(void) clrscr(); return 0; 函数名: textcolor int main(void) for (i=0; i<15; i++) return 0; 函数名: textheight #i nclude int main(void) /* initialize graphics and local variables */ /* read result of initialization */ /* draw some text on the screen */ /* create a message string */ /* output the message */ /* advance to the next text line */ /* clean up */ 函数名: textmode #i nclude int main(void) textmode(C40); textmode(BW80); textmode(C80); textmode(MONO); return 0; 函数名: textwidth #i nclude int main(void) /* initialize graphics and local variables */ /* read result of initialization */ y = getmaxy() / 2; settextjustify(LEFT_TEXT, CENTER_TEXT); /* create a message string */ /* output the message */ /* advance to the end of the text */ /* clean up */ 函数名: time #i nclude int main(void) t = time(NULL); 函数名: tmpfile #i nclude int main(void) tempfp = tmpfile(); return 0; 函数名: tmpnam #i nclude int main(void) tmpnam(name); 函数名: tolower #i nclude int main(void) length = strlen(string); return 0; 函数名: toupper #i nclude int main(void) length = strlen(string); printf("%s\n",string); return 0; 函数名: tzset #i nclude int main(void) putenv("TZ=PST8PDT"); 函数名: ultoa #i nclude int main( void ) ultoa(lnumber,string,10); return 0; 函数名: ungetc #i nclude int main( void ) puts("Input an integer followed by a char:"); /* read chars until non digit or EOF */ /* if non digit char was read, push it back into input buffer */ printf("i = %d, next char in buffer = %c\n", i, getchar()); 函数名: ungetch #i nclude int main( void ) puts("Input an integer followed by a char:"); /* read chars until non digit or EOF */ /* if non digit char was read, push it back into input buffer */ printf("\n\ni = %d, next char in buffer = %c\n", i, getch()); 函数名: unixtodos #i nclude char *month[] = {"---", "Jan", "Feb", "Mar", "Apr", "May", "Jun", #define SECONDS_PER_DAY 86400L /* the number of seconds in one day */ struct date dt; int main(void) /* get today‘s date and time */ /* convert date and time to unix format (number of seconds since Jan 1, 1970 */ /* convert back to dos time and date */ 函数名: unlink #i nclude int main(void) fprintf(fp,"junk"); status = access("junk.jnk",0); fclose(fp); return 0; 函数名: unlock #i nclude int main(void) handle = sopen("c:\\autoexec.bat",O_RDONLY,SH_DENYNO,S_IREAD); if (handle < 0) length = filelength(handle); if (status == 0) status = unlock(handle,0L,length/2); if (status == 0) close(handle); 函数名: vfprintf #i nclude FILE *fp; int vfpf(char *fmt, ...) va_start(argptr, fmt); return(cnt); int main(void) fp = tmpfile(); vfpf("%d %f %s", inumber, fnumber, string); return 0; 函数名: vfscanf #i nclude FILE *fp; int vfsf(char *fmt, ...) va_start(argptr, fmt); return(cnt); int main(void) fp = tmpfile(); vfsf("%d %f %s",&inumber,&fnumber,string); return 0; 函数名: vprintf #i nclude int vpf(char *fmt, ...) va_start(argptr, format); return(cnt); int main(void) vpf("%d %f %s\n",inumber,fnumber,string); return 0; 函数名: vscanf #i nclude int vscnf(char *fmt, ...) printf("Enter an integer, a float, and a string (e.g. i,f,s,)\n"); return(cnt); int main(void) vscnf("%d, %f, %s", &inumber, &fnumber, string); return 0; 函数名: vsprintf #i nclude char buffer[80]; int vspf(char *fmt, ...) va_start(argptr, fmt); return(cnt); int main(void) vspf("%d %f %s", inumber, fnumber, string); 函数名: vsscanf #i nclude char buffer[80] = "30 90.0 abc"; int vssf(char *fmt, ...) fflush(stdin); va_start(argptr, fmt); return(cnt); int main(void) vssf("%d %f %s", &inumber, &fnumber, string); 函数名: wherex #i nclude int main(void) return 0; 函数名: wherey #i nclude int main(void) return 0; 函数名: window |
C语言库函数大全及应用实例十四
时间: 2024-10-14 15:12:58
C语言库函数大全及应用实例十四的相关文章
C语言库函数大全及应用实例十
原文:C语言库函数大全及应用实例十 [编程资料]C语言库函数大全及应用实例十 函数名: qsort 功 能: 使用快速排序例程进行排序 用 法: void qsort(void *base, int nelem, int width, int (*fcmp)()); 程序例: #i nclude #i nclude #i nclude int sort_function( const void *a, con
C语言库函数大全及应用实例十二
原文:C语言库函数大全及应用实例十二 [编程资料]C语言库函数大全及应用实例十二 函数名: setrgbpalette 功 能: 定义IBM8514图形卡的颜色 用 法: void far setrgbpalette(int colornum, int red, int green, int blue); 程序例: #i nclude #i nclude #i nclude #i nclude int main(v
C语言库函数大全及应用实例六
原文:C语言库函数大全及应用实例六 [编程资料]C语言库函数大全及应用实例六 函数名: getlinesettings 功 能: 取当前线型.模式和宽度 用 法: void far getlinesettings(struct linesettingstype far *lininfo): 程序例: #i nclude #i nclude #i nclude #i nclude /* the names o
C语言库函数大全及应用实例九
原文:C语言库函数大全及应用实例九 [编程资料]C语言库函数大全及应用实例九 函数名: mktemp 功 能: 建立唯一的文件名 用 法: char *mktemp(char *template); 程序例: #i nclude #i nclude int main(void) { /* fname defines the template for the temporary file. */ char
C语言库函数大全及应用实例十三
原文:C语言库函数大全及应用实例十三 [编程资料]C语言库函数大全及应用实例十三 函数名: stat 功 能: 读取打开文件信息 用 法: int stat(char *pathname, struct stat *buff); 程序例: #i nclude #i nclude #i nclude #define FILENAME "TEST.$$$" int main(void) { struct st
C语言库函数大全及应用实例五
原文:C语言库函数大全及应用实例五 [编程资料]C语言库函数大全及应用实例五 函数名: getcurdir 功 能: 取指定驱动器的当前目录 用 法: int getcurdir(int drive, char *direc); 程序例: #i nclude #i nclude #i nclude char *current_directory(char *path) { strcpy(path, "
C语言库函数大全及应用实例十一
原文:C语言库函数大全及应用实例十一 [编程资料]C语言库函数大全及应用实例十一 函数名: setbkcolor 功 能: 用调色板设置当前背景颜色 用 法: void far setbkcolor(int color); 程序例: #i nclude #i nclude #i nclude #i nclude int main(void) { /* select a driver and mode that sup
C语言库函数大全及应用实例八
原文:C语言库函数大全及应用实例八 [编程资料]C语言库函数大全及应用实例八 函数名: kbhit 功 能: 检查当前按下的键 用 法: int kbhit(void); 程序例: #i nclude int main(void) { cprintf("Press any key to continue:"); while (!kbhit()) /* do nothing */ ; cprintf(&
C语言库函数大全及应用实例七
原文:C语言库函数大全及应用实例七 [编程资料]C语言库函数大全及应用实例七 函数名: getw 功 能: 从流中取一整数 用 法: int getw(FILE *strem); 程序例: #i nclude #i nclude #define FNAME "test.$$$" int main(void) { FILE *fp; int word; /* place the word in a file */ fp = fopen(FNAME, "wb"); if