Truxton message get file type

From truxwiki.com
Jump to navigation Jump to search

Gives you the type of the file.

Syntax

uint16_t truxton_message_get_file_type( uint64_t message_handle );

Parameters

message_handle

The handle to a message created by the truxton_message_create call.

Return value

The most accurate type of the file. This value corresponds to the [FileTypeID] column of the [File] table. It should be a value listed in the [ID] of the [FileType] table. Unless custom types have been added to Truxton, it will be one of the defined constant values.

Sample

void dump_file_type( uint64_t message )
{
   uint16_t type = truxton_message_get_file_type( message );

   printf( "Type is %" PRIu16 "\n", type );
}

The PRIu16 in the sample code above is a standard way of formatting a 16-bit unsigned integer in C. Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.