FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
file_loc.c
Go to the documentation of this file.
1
/* seek function and stmt */
2
3
#include "
fb.h
"
4
5
/*:::::*/
6
fb_off_t
fb_FileLocationEx
(
FB_FILE
*
handle
)
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
:
22
case
FB_FILE_MODE_OUTPUT
:
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
}
rtlib
file_loc.c
Generated on Thu Jan 23 2014 19:40:11 for FreeBASIC by
1.8.4