Difference between revisions of "Truxton investigation get id"

From truxwiki.com
Jump to navigation Jump to search
Line 9: Line 9:
 
=Parameters=
 
=Parameters=
 
==<code>investigation_handle</code>==
 
==<code>investigation_handle</code>==
The handle created by the [[truxton_investigation_create|truxton_investigation_create()]].
+
The handle created by [[truxton_investigation_create|truxton_investigation_create()]].
  
 
==<code>destination_string</code>==
 
==<code>destination_string</code>==

Revision as of 05:46, 11 April 2024

This retrieves the identifier of the investigation. It corresponds to the [ID] column of the [Investigation] table.

Syntax

void truxton_investigation_get_id( uint64_t investigation_handle, char * destination_string, size_t max_size );

Parameters

investigation_handle

The handle created by 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.