在Linux机器上,在从lseek64() method.But中获取一些时间错误后,在相同的偏移量上一段时间后,它没有给出任何错误和工作fine.In这种情况下,lseek64()方法返回-1。我们有自己的c库also.Now我们使用两个库,一个用于磁盘上的读/写,另一个用于捕获块更改信息使用我们自己的library.Two库是否会产生问题?
发布于 2012-10-12 14:47:21
您可以使用perror("Reason:");。这将使您对问题所在有所了解。
即在lseek64()调用之后,使用perror()。
/* Demonstration of error handling with perror() and errno. */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int main()
{
FILE *fp;
char filename[80];
printf("Enter filename: ");
gets(filename);
if (( fp = fopen(filename, "r")) == NULL)
{
perror("You goofed!");
printf("errno = %d.\n", errno);
exit(1);
}
else
{
puts("File opened for reading.");
fclose(fp);
}
return 0;
}https://stackoverflow.com/questions/12853650
复制相似问题