ftell_.c
Go to the documentation of this file.
00001 #include "f2c.h"
00002 #include "fio.h"
00003 #ifdef __cplusplus
00004 extern "C" {
00005 #endif
00006 
00007  static FILE *
00008 #ifdef KR_headers
00009 unit_chk(Unit, who) integer Unit; char *who;
00010 #else
00011 unit_chk(integer Unit, const char *who)
00012 #endif
00013 {
00014         if (Unit >= MXUNIT || Unit < 0)
00015                 f__fatal(101, who);
00016         return f__units[Unit].ufd;
00017         }
00018 
00019  integer
00020 #ifdef KR_headers
00021 ftell_(Unit) integer *Unit;
00022 #else
00023 ftell_(integer *Unit)
00024 #endif
00025 {
00026         FILE *f;
00027         return (f = unit_chk(*Unit, "ftell")) ? ftell(f) : -1L;
00028         }
00029 
00030  int
00031 #ifdef KR_headers
00032 fseek_(Unit, offset, whence) integer *Unit, *offset, *whence;
00033 #else
00034 fseek_(integer *Unit, integer *offset, integer *whence)
00035 #endif
00036 {
00037         FILE *f;
00038         int w = (int)*whence;
00039 #ifdef SEEK_SET
00040         static int wohin[3] = { SEEK_SET, SEEK_CUR, SEEK_END };
00041 #endif
00042         if (w < 0 || w > 2)
00043                 w = 0;
00044 #ifdef SEEK_SET
00045         w = wohin[w];
00046 #endif
00047         return  !(f = unit_chk(*Unit, "fseek"))
00048                 || fseek(f, *offset, w) ? 1 : 0;
00049         }
00050 #ifdef __cplusplus
00051 }
00052 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:50