Difference between revisions of "Truxton file length"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This tells you the size of the opened file in bytes. =Syntax= <syntaxhighlight lang="C"> int64_t truxton_file_length( uint64_t file_handle ) </syntaxhighlight> =Parameters= =...")
 
Line 8: Line 8:
 
==<code>file_handle</code>==
 
==<code>file_handle</code>==
  
The handle created by the [[truxton_file_open_id]] of [[truxton_file_open_md5]] call.
+
The handle created by the [[truxton_file_open_id]] or [[truxton_file_open_md5]] call.
  
 
=Return value=
 
=Return value=

Revision as of 09:06, 6 June 2020

This tells you the size of the opened file in bytes.

Syntax

int64_t truxton_file_length( uint64_t file_handle )

Parameters

file_handle

The handle created by the truxton_file_open_id or truxton_file_open_md5 call.

Return value

The length of the file in bytes.

Sample

int does_file_have_deep_philosophical_meaning(uint64_t truxton)
{
   uint64_t file = truxton_file_open_id(truxton, "5ed3aeb7-3da4-5f5c-8c8f-af5200000000");

   if ( file != 0 )
   {
      return(0);
   }

   int return_value = 0;

   if ( truxton_file_length( file ) > 42 )
   {
      truxton_file_seek(file, 42, 0 );

      if ( truxton_file_tell( file ) == 42 )
      {
         return_value = 1;
      }
   }

   truxton_file_free(file);

   return( return_value );
}