FreeBASIC  0.91.0
file_loc.c
Go to the documentation of this file.
1 /* seek function and stmt */
2 
3 #include "fb.h"
4 
5 /*:::::*/
7 {
8  fb_off_t pos;
9 
10  if( !FB_HANDLE_USED(handle) )
11  return 0;
12 
13  FB_LOCK();
14 
15  pos = fb_FileTellEx( handle );
16 
17  if (pos != 0) {
18  --pos;
19  switch( handle->mode )
20  {
21  case FB_FILE_MODE_INPUT:
23  /* if in seq mode, divide by 128 (QB quirk) */
24  pos /= 128;
25  break;
26  }
27  }
28 
29  FB_UNLOCK();
30 
31  return pos;
32 }
33 
34 /*:::::*/
35 FBCALL long long fb_FileLocation( int fnum )
36 {
37  return fb_FileLocationEx( FB_FILE_TO_HANDLE(fnum) );
38 }