FreeBASIC  0.91.0
file_len.c
Go to the documentation of this file.
1 /* get file length by filename */
2 
3 #include "fb.h"
4 
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 );
19  return len;
20  }
21  }
22 
23  fclose( fp );
24  }
25 
27  return 0;
28 }
29 
30 FBCALL long long fb_FileLen( const char *filename )
31 {
32  return fb_FileLenEx( filename );
33 }