我试图使用seek在c编程中获取文件大小。我无法使用fseek,stat.size或ftell,还有一个需要运行的自定义操作系统unix。 我怎么才能找到文件大小只是通过使用查找?可能吗?谢谢!如何查找文件末尾以确定文件大小?
FILE *fd = open(argv[1], "r");
if(fd == NULL)
{
printf("Not able to open the file : %s\n", argv[1]);
return;
}
// Set the pointer to the end
seek(fd, 0, SEEK_END);
为什么你不能使用fseek,stat.size或ftell?你可以使用getch()吗?这是我能想到的唯一方法。 – Chriszuma
你在说什么这个'seek'函数? – Mat
scanf怎么样? – 2011-10-13 16:23:47