Truxton jurisdiction get name

From truxwiki.com
Jump to navigation Jump to search

This retrieves the name of the jurisdiction. This corresponds to the [Name] column of the [Jurisdiction] table.

Syntax

void truxton_jurisdiction_get_name( uint64_t jurisdiction_handle, char * destination_string, size_t maximum_size );

Parameters

jurisdiction_handle

The handle to the file type object. This handle comes from calling truxton_jurisdiction_create().

destination_string

The string buffer where the name will go.

maximum_size

The size of the destination_string buffer. The maximum number of characters written to the buffer will be maximum_size minus one to leave room for the null terminator.

Sample

void dump( uint64_t jurisdiction )
{
   char temporary_string[ 256 ];

   uint64_t id= truxton_jurisdiction_get_id( jurisdiction );

   printf( "ID: %" PRIu64 "\n", id );

   truxton_jurisdiction_get_name( jurisdiction, temporary_string, sizeof( temporary_string ) );
   printf( "Name: %s\n", temporary_string );

   truxton_jurisdiction_get_description( jurisdiction, temporary_string, sizeof( temporary_string ) );
   printf( "Description: %s\n", temporary_string );
}

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.