Menu

[424828]: / src / rtlib / file_len.c  Maximize  Restore  History

Download this file

34 lines (27 with data), 523 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* get file length by filename */
#include "fb.h"
fb_off_t fb_FileLenEx( const char *filename )
{
FILE *fp;
fb_off_t len;
fp = fopen( filename, "rb" );
if( fp != NULL )
{
if( fseeko( fp, 0, SEEK_END ) == 0 )
{
if( (len = ftello( fp )) != -1 )
{
fclose( fp );
fb_ErrorSetNum( FB_RTERROR_OK );
return len;
}
}
fclose( fp );
}
fb_ErrorSetNum( FB_RTERROR_ILLEGALFUNCTIONCALL );
return 0;
}
FBCALL long long fb_FileLen( const char *filename )
{
return fb_FileLenEx( filename );
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.