FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
file_len.c
Go to the documentation of this file.
1
/* get file length by filename */
2
3
#include "
fb.h
"
4
5
fb_off_t
fb_FileLenEx
(
const
char
*
filename
)
6
{
7
FILE *fp;
8
fb_off_t
len;
9
10
fp = fopen( filename,
"rb"
);
11
if
( fp !=
NULL
)
12
{
13
if
(
fseeko
( fp, 0, SEEK_END ) == 0 )
14
{
15
if
( (len =
ftello
( fp )) != -1 )
16
{
17
fclose( fp );
18
fb_ErrorSetNum
(
FB_RTERROR_OK
);
19
return
len;
20
}
21
}
22
23
fclose( fp );
24
}
25
26
fb_ErrorSetNum
(
FB_RTERROR_ILLEGALFUNCTIONCALL
);
27
return
0;
28
}
29
30
FBCALL
long
long
fb_FileLen
(
const
char
*
filename
)
31
{
32
return
fb_FileLenEx
( filename );
33
}
rtlib
file_len.c
Generated on Thu Jan 23 2014 19:40:11 for FreeBASIC by
1.8.4