1、函数大全t开头函数大全(t开头)函数名:tan 功能:正切函数 用法:doubletan(doublex); 程序例: #include #include intmain(void) doubleresult,x; x=0.5; result=tan(x); printf(Thetanof%lfis%lfn,x,result); return0; 函数名:tanh 功能:双曲正切函数 用法:doubletanh(doublex); 程序例: #include #include intmain(void) doubleresult,x; x=0.5; result=tanh(x); printf
2、(Thehyperbolictangentof%lfis%lfn,x,result); return0; 函数名:tell 功能:取文件指针的当前位置 用法:longtell(inthandle); 程序例: #include #include #include #include intmain(void) inthandle; charmsg=Helloworld; if(handle=open(TEST.$,O_CREAT|O_TEXT|O_APPEND)=-1) perror(Error:); return1; write(handle,msg,strlen(msg); printf(T
3、hefilepointerisatbyte%ldn,tell(handle); close(handle); return0; 函数名:textattr 功能:设置文本属性 用法:voidtextattr(intattribute); 程序例: #include intmain(void) inti; clrscr(); for(i=0;i9;i+) textattr(i+(i+1)4); cprintf(Thisisatestrn); return0; 函数名:textbackground 功能:选择新的文本背景颜色 用法:voidtextbackground(intcolor); 程序例:
4、 #include intmain(void) inti,j; clrscr(); for(i=0;i9;i+) for(j=0;j80;j+) cprintf(C); cprintf(rn); textcolor(i+1); textbackground(i); return0; 函数名:textcolor 功能:在文本模式中选择新的字符颜色 用法:voidtextcolor(intcolor); 程序例: #include intmain(void) inti; for(i=0;i15;i+) textcolor(i); cprintf(ForegroundColorrn); return
5、0; 函数名:textheight 功能:返回以像素为单位的字符串高度 用法:intfartextheight(charfar*textstring); 程序例: #include #include #include #include intmain(void) /*requestautodetection*/ intgdriver=DETECT,gmode,errorcode; inty=0; inti; charmsg80; /*initializegraphicsandlocalvariables*/ initgraph(&gdriver,&gmode,); /*readresultof
6、initialization*/ errorcode=graphresult(); if(errorcode!=grOk)/*anerroroccurred*/ printf(Graphicserror:%sn,grapherrormsg(errorcode); printf(Pressanykeytohalt:); getch(); exit(1);/*terminatewithanerrorcode*/ /*drawsometextonthescreen*/ for(i=1;i11;i+) /*selectthetextstyle,direction,andsize*/ settextst
7、yle(TRIPLEX_FONT,HORIZ_DIR,i); /*createamessagestring*/ sprintf(msg,Size:%d,i); /*outputthemessage*/ outtextxy(1,y,msg); /*advancetothenexttextline*/ y+=textheight(msg); /*cleanup*/ getch(); closegraph(); return0; 函数名:textmode 功能:将屏幕设置成文本模式 用法:voidtextmode(intmode); 程序例: #include intmain(void) textm
8、ode(BW40); cprintf(ABC); getch(); textmode(C40); cprintf(ABC); getch(); textmode(BW80); cprintf(ABC); getch(); textmode(C80); cprintf(ABC); getch(); textmode(MONO); cprintf(ABC); getch(); return0; 函数名:textwidth 功能:返回以像素为单位的字符串宽度 用法:intfartextwidth(charfar*textstring); 程序例: #include #include #include
9、 #include intmain(void) /*requestautodetection*/ intgdriver=DETECT,gmode,errorcode; intx=0,y=0; inti; charmsg80; /*initializegraphicsandlocalvariables*/ initgraph(&gdriver,&gmode,); /*readresultofinitialization*/ errorcode=graphresult(); if(errorcode!=grOk)/*anerroroccurred*/ printf(Graphicserror:%s
10、n,grapherrormsg(errorcode); printf(Pressanykeytohalt:); getch(); exit(1);/*terminatewithanerrorcode*/ y=getmaxy()/2; settextjustify(LEFT_TEXT,CENTER_TEXT); for(i=1;i11;i+) /*selectthetextstyle,direction,andsize*/ settextstyle(TRIPLEX_FONT,HORIZ_DIR,i); /*createamessagestring*/ sprintf(msg,Size:%d,i)
11、; /*outputthemessage*/ outtextxy(x,y,msg); /*advancetotheendofthetext*/ x+=textwidth(msg); /*cleanup*/ getch(); closegraph(); return0; 函数名:time 功能:取一天的时间 用法:logntime(long*tloc); 程序例: #include #include #include intmain(void) time_tt; t=time(NULL); printf(ThenumberofsecondssinceJanuary1,1970is%ld,t);
12、return0; 函数名:tmpfile 功能:以二进制方式打开暂存文件 用法:FILE*tmpfile(void); 程序例: #include #include intmain(void) FILE*tempfp; tempfp=tmpfile(); if(tempfp) printf(Temporaryfilecreatedn); else printf(Unabletocreatetemporaryfilen); exit(1); return0; 函数名:tmpnam 功能:创建一个唯一的文件名 用法:char*tmpnam(char*sptr); 程序例: #include int
13、main(void) charname13; tmpnam(name); printf(Temporaryname:%sn,name); return0; 函数名:tolower 功能:把字符转换成小写字母 用法:inttolower(intc); 程序例: #include #include #include intmain(void) intlength,i; char*string=THISISASTRING; length=strlen(string); for(i=0;ilength;i+) stringi=tolower(stringi); printf(%sn,string);
14、return0; 函数名:toupper 功能:把字符转换成大写字母 用法:inttoupper(intc); 程序例: #include #include #include intmain(void) intlength,i; char*string=thisisastring; length=strlen(string); for(i=0;ilength;i+) stringi=toupper(stringi); printf(%sn,string); return0; 函数名:tzset 功能:UNIX时间兼容函数 用法:voidtzset(void); 程序例: #include #include #include intmain(void) time_ttd; putenv(TZ=PST8PDT); tzset(); time(&td); printf(Currenttime=%sn,asctime(localtime(&td); return0;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1