0

On Linux machine,getting some time error in seek from lseek64() method.But after some time on same offset it is not giving any error and working fine.In this case lseek64() method is returning -1.We have our own c library also.Now we are using two library one for read/write on disk and another for capturing block change information using our own library.Two library can create problem?

Nilesh Shukla
  • 309
  • 2
  • 5
  • 12

1 Answers1

1

You can use perror("Reason:");. This will give you some idea where the issue is.

i.e After lseek64() call, use 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;
 }
Jeyaram
  • 9,158
  • 7
  • 41
  • 63