C语言函数大全(t开头)

文章作者 100test 发表时间 2007:03:10 17:25:32
来源 100Test.Com百考试题网


函数名: tell
功 能: 取文件指针的当前位置
用 法: long tell(int handle).
程序例:
#include
#include
#include
#include
int main(void)
{
int handle.
char msg[] = "Hello world".
if ((handle = open("TEST.$$$", O_CREAT | O_TEXT | O_APPEND)) == -1)
{
perror("Error:").
return 1.
}
write(handle, msg, strlen(msg)).
printf("The file pointer is at byte %ld\n", tell(handle)).
close(handle).
return 0.
}




函数名: textattr
功 能: 设置文本属性
用 法: void textattr(int attribute).
程序例:
#include
int main(void)
{
int i.
clrscr().
for (i=0. i<9. i )
{
textattr(i ((i 1) << 4)).
cprintf("This is a test\r\n").
}
return 0.
}



函数名: textbackground
功 能: 选择新的文本背景颜色
用 法: void textbackground(int color).
程序例:
#include
int main(void)
{
int i, j.
clrscr().
for (i=0. i<9. i )
{
for (j=0. j<80. j )
cprintf("C").
cprintf("\r\n").
textcolor(i 1).
textbackground(i).
}
return 0.
}



函数名: textcolor
功 能: 在文本模式中选择新的字符颜色
用 法: void textcolor(int color).
程序例:
#include
int main(void)
{
int i.
for (i=0. i<15. i )
{
textcolor(i).
cprintf("Foreground Color\r\n").
}
return 0.
}



函数名: textheight
功 能: 返回以像素为单位的字符串高度
用 法: int far textheight(char far *textstring).
程序例:
#include
#include
#include
#include
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode.
int y = 0.
int i.
char msg[80].
/* initialize graphics and local variables */
initgraph(&.gdriver, &.gmode, "").
/* 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 */
}
/* draw some text on the screen */
for (i=1. i<11. i )
{
/* 0select the text style, direction, and size */
settextstyle(TRIPLEX_FONT, HORIZ_DIR, i).
/* create a message string */
sprintf(msg, "Size: %d", i).
/* output the message */
outtextxy(1, y, msg).
/* advance to the next text line */
y = textheight(msg).
}
/* clean up */
getch().
closegraph().
return 0.
}



函数名: textmode
功 能: 将屏幕设置成文本模式
用 法: void textmode(int mode).
程序例:
#include
int main(void)
{
textmode(BW40).
cprintf("ABC").
getch().
textmode(C40).
cprintf("ABC").

相关文章


全国计算机等级考试(24次)通知
重庆:第23次全国计算机等级考试成绩查询开通
C语言函数大全(t开头)
C语言函数大全(s开头)(2)
北京:公布2006年下半年全国计算机等级考试报考简章
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛