GRASS Programmer's Manual
6.4.2(2012)
|
00001 00014 #include <stdio.h> 00015 #include <sys/types.h> 00016 #include <grass/gis.h> 00017 #include <grass/glocale.h> 00018 00027 int G_ftell(FILE *fp) 00028 { 00029 #ifdef HAVE_FSEEKO 00030 return ftello(fp); 00031 #else 00032 return (int) ftell(fp); 00033 #endif 00034 } 00035 00048 void G_fseek(FILE *fp, int offset, int whence) 00049 { 00050 #ifdef HAVE_FSEEKO 00051 if (fseeko(fp, offset, whence) != 0) 00052 G_fatal_error(_("Unable to seek")); 00053 #else 00054 long loff = (long) offset; 00055 if ((int) loff != offset) 00056 G_fatal_error(_("Seek offset out of range")); 00057 if (fseek(fp, loff, whence) != 0) 00058 G_fatal_error(_("Unable to seek")); 00059 #endif 00060 }