Difference between revisions of "Truxton child file get truxton"
Jump to navigation
Jump to search
(Created page with "This retrieves the handle to the Truxton instance handling this file object. =Syntax= <syntaxhighlight lang="C"> uint64_t truxton_child_file_get_truxton( uint64_t child_handl...") |
|||
| Line 2: | Line 2: | ||
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="C"> |
uint64_t truxton_child_file_get_truxton( uint64_t child_handle ); | uint64_t truxton_child_file_get_truxton( uint64_t child_handle ); | ||
| − | </ | + | </source> |
=Parameters= | =Parameters= | ||
==<code>child_handle</code>== | ==<code>child_handle</code>== | ||
| − | |||
The handle created by the [[truxton_child_file_create]] or [[truxton_file_create_child]] call. | The handle created by the [[truxton_child_file_create]] or [[truxton_file_create_child]] call. | ||
| Line 20: | Line 19: | ||
=Sample= | =Sample= | ||
| − | + | <source lang="C" highlight="8"> | |
| − | < | + | void conditionally_add( uint64_t parent_file ) |
| − | void conditionally_add(uint64_t parent_file) | ||
{ | { | ||
| − | if ( truxton_child_file_get_type(parent_file) != Type_FileSystemRoot ) | + | if ( truxton_child_file_get_type( parent_file ) != Type_FileSystemRoot ) |
{ | { | ||
return; | return; | ||
} | } | ||
| − | int64_t truxton = truxton_child_file_get_truxton(truxton); | + | int64_t truxton = truxton_child_file_get_truxton( truxton ); |
| − | truxton_start_adding_files(truxton); | + | truxton_start_adding_files( truxton ); |
} | } | ||
| − | </ | + | </source> |
Latest revision as of 03:55, 13 February 2021
This retrieves the handle to the Truxton instance handling this file object.
Syntax
uint64_t truxton_child_file_get_truxton( uint64_t child_handle );
Parameters
child_handle
The handle created by the truxton_child_file_create or truxton_file_create_child 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 conditionally_add( uint64_t parent_file )
{
if ( truxton_child_file_get_type( parent_file ) != Type_FileSystemRoot )
{
return;
}
int64_t truxton = truxton_child_file_get_truxton( truxton );
truxton_start_adding_files( truxton );
}