tell函数
函數名: 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;
}
功 能: 取文件指針的當前位置
用 法: 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;
}
轉載于:https://www.cnblogs.com/eagleking0318/archive/2011/03/03/6521281.html
總結
- 上一篇: 2021 Summary
- 下一篇: 基于多头注意力机制LSTM股价预测模型