Difference between revisions of "Truxton file get truxton"
Jump to navigation
Jump to search
(→Sample) |
(→Sample) |
||
| Line 21: | Line 21: | ||
<syntaxhighlight lang="C" highlight="10"> | <syntaxhighlight lang="C" highlight="10"> | ||
| − | + | void print_it(uint64_t truxton) | |
{ | { | ||
uint64_t file = truxton_file_open_md5(truxton, "9ec8fb6095c35eff2b236863b7caaf10"); | uint64_t file = truxton_file_open_md5(truxton, "9ec8fb6095c35eff2b236863b7caaf10"); | ||
| Line 27: | Line 27: | ||
if ( file != 0 ) | if ( file != 0 ) | ||
{ | { | ||
| − | return | + | return; |
} | } | ||
Revision as of 07:55, 21 June 2020
This retrieves the handle to the Truxton instance handling this file object.
Syntax
uint64_t truxton_file_get_truxton( uint64_t file_handle );
Parameters
file_handle
The handle created by the truxton_file_open_id or truxton_file_open_md5 call.
Return value
A non-zero value on success, zero on failure.
Remarks
This allows you to call any API that requires a handle to the Truxton object. Many times, in code, you are given one type of thing but need another. Should you find yourself in a situation where you were given file handle and you need to do something at the Truxton level, you can get the handle you need.
Sample
void print_it(uint64_t truxton)
{
uint64_t file = truxton_file_open_md5(truxton, "9ec8fb6095c35eff2b236863b7caaf10");
if ( file != 0 )
{
return;
}
uint64_t truxton = truxton_file_get_truxton( file );
char version_string[ 40 ];
truxton_get_version( truxton , version_string, sizeof( version_string ) );
printf( "Version: %s\n", version_string );
truxton_file_free( file );
}