idx

C library providing a standard for (non-standard) 64-bit file indexing functions.
git clone git://src.gearsix.net/idx
Log | Files | Refs | Atom | README

idx_posix.c (416B)


      1 #include "idx.h"
      2 
      3 #ifdef IDX_POSIX
      4 
      5 #include <stdlib.h> /* strtoull */
      6 
      7 int idxseek(FILE *stream, idx_t offset, int origin)
      8 {
      9 	return fseeko(stream, (off_t)offset, origin);
     10 }
     11 
     12 idx_t idxtell(FILE *stream)
     13 {
     14 	return (idx_t)ftello(stream);
     15 }
     16 
     17 idx_t strtoidx(const char *s, char **end, int base)
     18 {
     19 	return (idx_t)strtoull(s, end, base);
     20 }
     21 
     22 int idxtostr(idx_t i, char **buf)
     23 {
     24 	return sprintf(*buf, "%llu", i);
     25 }
     26 
     27 #endif