Truxton subject get description

From truxwiki.com
Jump to navigation Jump to search

This retrieves the description of the subject. This corresponds to the [Description] column of the [Suspect] table.

Syntax

void truxton_subject_get_description( uint64_t subject_handle, char * destination_string, size_t max_size );

Parameters

subject_handle

This comes from calling truxton_subject_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_subject( uint64_t subject_handle )
{
   uint64_t integer_value = 0;

   char temp_string[ 1024 ];

   truxton_subject_get_id( subject_handle, temp_string, sizeof(temp_string) );
   printf( "Subject ID is %s\n", temp_string );

   truxton_subject_get_name( subject_handle, temp_string, sizeof(temp_string) );
   printf( "Name: %s\n", temp_string );

   truxton_subject_get_description( subject_handle, temp_string, sizeof(temp_string) );
   printf( "Description: %s\n", temp_string );

   truxton_subject_get_custom( subject_handle, temp_string, sizeof(temp_string) );
   printf( "Custom: %s\n", temp_string );

   truxton_subject_get_picture( subject_handle, temp_string, sizeof(temp_string) );
   display_base64_encoded_png( temp_string );

   integer_value = truxton_subject_get_birthday( subject_handle );

   if ( integer_value == 0 )
   {
      printf( "Birthday: Unknown\n" );
   }
   else
   {
      printf( "Birthday: %" PRIu64 "\n", integer_value );
   }
}

The PRIu64 in the sample code above is a standard way of formatting a 64-bit unsigned 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.