Truxton jurisdiction get id

From truxwiki.com
Revision as of 16:15, 18 February 2021 by Sam (talk | contribs) (→‎Sample)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This returns the integer identifier for the jurisdiction. This corresponds to the [ID] column of the [Jurisdiction] table.

Syntax

uint64_t truxton_jurisdiction_get_id( uint64_t jurisdiction_handle );

Parameters

jurisdiction_handle

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

Return value

The integer identifier for the jurisdiction.

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.