Welcome

首页 / 软件开发 / C语言 / C语言函数大全(t开头)

C语言函数大全(t开头)2010-01-29函数名: 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 ", 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 ");
}
return 0;
}