Difference between revisions of "Truxton file is closed"
Jump to navigation
Jump to search
(Created page with "This tells you if the file handle has been closed. If it has, you can no longer read bytes from it. =Syntax= <syntaxhighlight lang="C"> int truxton_file_is_closed( uint64_t fi...") |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
If it has, you can no longer read bytes from it. | If it has, you can no longer read bytes from it. | ||
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="C"> |
| − | int truxton_file_is_closed( uint64_t file_handle ) | + | int truxton_file_is_closed( uint64_t file_handle ); |
| − | </ | + | </source> |
=Parameters= | =Parameters= | ||
==<code>file_handle</code>== | ==<code>file_handle</code>== | ||
| − | + | The handle created by the [[truxton_file_open_id]] or [[truxton_file_open_md5]] call. | |
| − | The handle created by the [[truxton_file_open_id]] | ||
=Return value= | =Return value= | ||
| Line 15: | Line 14: | ||
=Sample= | =Sample= | ||
| − | + | <source lang="C" highlight="12"> | |
| − | < | + | void test_close( uint64_t truxton ) |
| − | void test_close(uint64_t truxton) | ||
{ | { | ||
| − | uint64_t file = truxton_file_open_id(truxton, "5ed3aeb7-3da4-5f5c-8c8f-af5200000000"); | + | uint64_t file = truxton_file_open_id( truxton, "5ed3aeb7-3da4-5f5c-8c8f-af5200000000" ); |
if ( file != 0 ) | if ( file != 0 ) | ||
| Line 30: | Line 28: | ||
if ( truxton_file_is_closed( file ) == 0 ) | if ( truxton_file_is_closed( file ) == 0 ) | ||
{ | { | ||
| − | printf("Truxton file is broken. Can't close file.\n" ); | + | printf( "Truxton file is broken. Can't close file.\n" ); |
} | } | ||
| − | truxton_file_free(file); | + | truxton_file_free( file ); |
} | } | ||
| − | </ | + | </source> |
Latest revision as of 17:33, 10 February 2021
This tells you if the file handle has been closed. If it has, you can no longer read bytes from it.
Syntax
int truxton_file_is_closed( uint64_t file_handle );
Parameters
file_handle
The handle created by the truxton_file_open_id or truxton_file_open_md5 call.
Return value
If file contents are not available, the return value will be 1, otherwise it will be zero.
Sample
void test_close( uint64_t truxton )
{
uint64_t file = truxton_file_open_id( truxton, "5ed3aeb7-3da4-5f5c-8c8f-af5200000000" );
if ( file != 0 )
{
return;
}
truxton_file_close( file );
if ( truxton_file_is_closed( file ) == 0 )
{
printf( "Truxton file is broken. Can't close file.\n" );
}
truxton_file_free( file );
}