Difference between revisions of "Truxton investigation get id"
Jump to navigation
Jump to search
(Created page with "This retrieves the identifier of the investigation. It corresponds to the <code>[ID]</code> column of the <code>[Investigation]</code> table. =Syntax= <source lang="C"> void...") |
|||
| Line 18: | Line 18: | ||
=Sample= | =Sample= | ||
| − | <source lang="C" highlight=" | + | <source lang="C" highlight="6"> |
void dump( uint64_t investigation_handle ) | void dump( uint64_t investigation_handle ) | ||
{ | { | ||
| − | char | + | uint64_t integer_value = 0; |
| + | char string_value[ 256 ]; | ||
| − | truxton_investigation_get_id( investigation_handle, | + | truxton_investigation_get_id( investigation_handle, string_value, sizeof( string_value ) ) ; |
| − | printf( "ID: %s\n", | + | printf( "ID: %s\n", string_value ); |
| + | |||
| + | truxton_investigation_get_name( investigation_handle, string_value, sizeof( string_value ) ); | ||
| + | printf( "Name: %s\n", string_value ); | ||
| + | |||
| + | truxton_investigation_get_description( investigation_handle, string_value, sizeof( string_value ) ); | ||
| + | printf( "Description: %s\n", string_value ); | ||
| + | |||
| + | truxton_investigation_get_case_number( investigation_handle, string_value, sizeof( string_value ) ); | ||
| + | printf( "Case: %s\n", string_value ); | ||
| + | |||
| + | truxton_investigation_get_case_number( investigation_handle, string_value, sizeof( string_value ) ); | ||
| + | printf( "Case: %s\n", string_value ); | ||
| + | |||
| + | truxton_investigation_get_jurisdiction( investigation_handle, string_value, sizeof( string_value ) ); | ||
| + | printf( "Jurisdiction: %s\n", string_value ); | ||
| + | |||
| + | integer_value = truxton_investigation_get_status( investigation_handle ); | ||
| + | printf( "Status: " PRIu64 "\n", integer_value ); | ||
| + | |||
| + | integer_value = truxton_investigation_get_type( investigation_handle ); | ||
| + | printf( "Type: " PRIu64 "\n", integer_value ); | ||
} | } | ||
</source> | </source> | ||
Revision as of 10:02, 18 February 2021
This retrieves the identifier of the investigation.
It corresponds to the [ID] column of the [Investigation] table.
Contents
Syntax
void truxton_investigation_get_id( uint64_t investigation_handle, char * destination_string, size_t max_size );
Parameters
investigation_handle
The handle created by the truxton_investigation_create().
destination_string
The string to be written to.
max_size
The maximum number of characters that can be written to destination_string.
Sample
void dump( uint64_t investigation_handle )
{
uint64_t integer_value = 0;
char string_value[ 256 ];
truxton_investigation_get_id( investigation_handle, string_value, sizeof( string_value ) ) ;
printf( "ID: %s\n", string_value );
truxton_investigation_get_name( investigation_handle, string_value, sizeof( string_value ) );
printf( "Name: %s\n", string_value );
truxton_investigation_get_description( investigation_handle, string_value, sizeof( string_value ) );
printf( "Description: %s\n", string_value );
truxton_investigation_get_case_number( investigation_handle, string_value, sizeof( string_value ) );
printf( "Case: %s\n", string_value );
truxton_investigation_get_case_number( investigation_handle, string_value, sizeof( string_value ) );
printf( "Case: %s\n", string_value );
truxton_investigation_get_jurisdiction( investigation_handle, string_value, sizeof( string_value ) );
printf( "Jurisdiction: %s\n", string_value );
integer_value = truxton_investigation_get_status( investigation_handle );
printf( "Status: " PRIu64 "\n", integer_value );
integer_value = truxton_investigation_get_type( investigation_handle );
printf( "Type: " PRIu64 "\n", integer_value );
}
Note, the PRIu64 in the sample code above is the new standard way of formatting a 64-bit 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.