求教几个TC中的函数。。。

来源:百度知道 编辑:UC知道 时间:2024/05/26 22:23:22
看到一篇TC的关于汉字显示的程序,可惜有一个函数(lseek)不明白怎么用,一个函数(read)不是很明白。。。希望各位大大能不吝赐教!先谢过了昂!
还有,涉及到字库,能有大大指点一下迷津吗?(WordLib.chi和WordLib.asc)小弟我找不到相应的文件啊。。。
呃,又出现一个函数 —— sopen 这个函数的格式是什么啊? 怎么用? 来个全点的答案。。。 解释能详细点更好。。还有,看清函数。。。。。

函数名: fseek
功 能: 重定位流上的文件指针
用 法: int fseek(FILE *stream, long offset, int fromwhere);
程序例:

#include <stdio.h>

long filesize(FILE *stream);

int main(void)
{
FILE *stream;

stream = fopen("MYFILE.TXT", "w+");
fprintf(stream, "This is a test");
printf("Filesize of MYFILE.TXT is %ld bytes\n", filesize(stream));
fclose(stream);
return 0;
}

long filesize(FILE *stream)
{
long curpos, length;

curpos = ftell(stream);
fseek(stream, 0L, SEEK_END);
length = ftell(stream);
fseek(stream, curpos, SEEK_SET);
return length;
}

函数名: fopen
功 能: 打开一个流
用 法: FILE *fopen(char *filename, char *type);
程序例:

#include <stdlib.h>
#include <stdio.h>
#include <dir.h>