📄 ft.htm
字号:
{ <br>
textmode(BW40); <br>
cprintf("ABC"); <br>
getch(); </p>
<p> textmode(C40); <br>
cprintf("ABC"); <br>
getch(); </p>
<p> textmode(BW80); <br>
cprintf("ABC"); <br>
getch(); </p>
<p> textmode(C80); <br>
cprintf("ABC"); <br>
getch(); </p>
<p> textmode(MONO); <br>
cprintf("ABC"); <br>
getch(); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: textwidth <br>
功 能: 返回以像素为单位的字符串宽度
<br>
用 法: int far textwidth(char far *textstring); <br>
程序例: </p>
<p>#include <graphics.h> <br>
#include <stdlib.h> <br>
#include <stdio.h> <br>
#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
/* request auto detection */ <br>
int gdriver = DETECT, gmode, errorcode; <br>
int x = 0, y = 0; <br>
int i; <br>
char msg[80]; </p>
<p> /* initialize graphics and local
variables */ <br>
initgraph(&gdriver, &gmode,
""); </p>
<p> /* read result of initialization */ <br>
errorcode = graphresult(); <br>
if (errorcode != grOk) /* an error
occurred */ <br>
{ <br>
printf("Graphics
error: %s\n", grapherrormsg(errorcode)); <br>
printf("Press any key
to halt:"); <br>
getch(); <br>
exit(1); /* terminate with
an error code */ <br>
} </p>
<p> y = getmaxy() / 2; </p>
<p> settextjustify(LEFT_TEXT, CENTER_TEXT); <br>
for (i=1; i<11; i++) <br>
{ <br>
/* select the text style,
direction, and size */ <br>
settextstyle(TRIPLEX_FONT,
HORIZ_DIR, i); </p>
<p> /* create a message
string */ <br>
sprintf(msg, "Size:
%d", i); </p>
<p> /* output the message
*/ <br>
outtextxy(x, y, msg); </p>
<p> /* advance to the end
of the text */ <br>
x += textwidth(msg); <br>
} </p>
<p> /* clean up */ <br>
getch(); <br>
closegraph(); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: time <br>
功 能: 取一天的时间 <br>
用 法: logn time(long *tloc); <br>
程序例: </p>
<p>#include <time.h> <br>
#include <stdio.h> <br>
#include <dos.h> </p>
<p>int main(void) <br>
{ <br>
time_t t; </p>
<p> t = time(NULL); <br>
printf("The number of seconds since
January 1, 1970 is %ld",t); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: tmpfile <br>
功 能: 以二进制方式打开暂存文件 <br>
用 法: FILE *tmpfile(void); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <process.h> </p>
<p>int main(void) <br>
{ <br>
FILE *tempfp; </p>
<p> tempfp = tmpfile(); <br>
if (tempfp) <br>
printf("Temporary
file created\n"); <br>
else <br>
{ <br>
printf("Unable to
create temporary file\n"); <br>
exit(1); <br>
} </p>
<p> return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: tmpnam <br>
功 能: 创建一个唯一的文件名 <br>
用 法: char *tmpnam(char *sptr); <br>
程序例: </p>
<p>#include <stdio.h> </p>
<p>int main(void) <br>
{ <br>
char name[13]; </p>
<p> tmpnam(name); <br>
printf("Temporary name: %s\n",
name); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: tolower <br>
功 能: 把字符转换成小写字母 <br>
用 法: int tolower(int c); <br>
程序例: </p>
<p>#include <string.h> <br>
#include <stdio.h> <br>
#include <ctype.h> </p>
<p>int main(void) <br>
{ <br>
int length, i; <br>
char *string = "THIS IS A STRING";
</p>
<p> length = strlen(string); <br>
for (i=0; i<length; i++) <br>
{ <br>
string[i] =
tolower(string[i]); <br>
} <br>
printf("%s\n",string); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: toupper <br>
功 能: 把字符转换成大写字母 <br>
用 法: int toupper(int c); <br>
程序例: </p>
<p>#include <string.h> <br>
#include <stdio.h> <br>
#include <ctype.h> </p>
<p>int main(void) <br>
{ <br>
int length, i; <br>
char *string = "this is a string";
</p>
<p> length = strlen(string); <br>
for (i=0; i<length; i++) <br>
{ <br>
string[i] =
toupper(string[i]); <br>
} </p>
<p> printf("%s\n",string); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: tzset <br>
功 能: UNIX时间兼容函数 <br>
用 法: void tzset(void); <br>
程序例: </p>
<p>#include <time.h> <br>
#include <stdlib.h> <br>
#include <stdio.h> </p>
<p>int main(void) <br>
{ <br>
time_t td; </p>
<p> putenv("TZ=PST8PDT"); <br>
tzset(); <br>
time(&td); <br>
printf("Current time = %s\n",
asctime(localtime(&td))); <br>
return 0; <br>
} <br>
</p>
</td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="0" cellspacing="1" width="640">
<tr>
<td class="p9" height="60"> <script>document.write("<p><a href=\"http://view.gznet.com/cgi-bin/rl_views.cgi?UID=10013421\" target=sxrl>");
document.write("<img src=\"http://refer.gznet.com/cgi-bin/rl_refer2.cgi?UID=10013421&refer="+escape(top.document.referrer)+"\" width=1 height=1 border=0 alt=\" \">");
document.write("</a>");
</script></td>
</tr>
</table>
</center></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -