Truxton location create

From truxwiki.com
Revision as of 11:50, 11 December 2020 by Sam (talk | contribs) (Created page with "This creates a location object. This corresponds to the <code><nowiki>[</nowiki>Location<nowiki>]</nowiki></code> table. =Syntax= <source lang="C"> uint64_...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This creates a location object. This corresponds to the [Location] table.

Syntax

uint64_t truxton_location_create(uint64_t truxton_handle);

Parameters

truxton_handle

The Truxton instance this location will belong. This handle comes from calling truxton_create().

Return value

A handle to a location object.

Sample

void create_location(void)
{
   uint64_t truxton = truxton_create();

   uint64_t location = truxton_location_create(truxton);

   truxton_location_save();

   uint64_t new_id = truxton_file_get_id( file_type );

   if ( new_id == 0 )
   {
      printf( "Failed to create new file type\n" );
   }
   else
   {
      printf( "Created new file type as id %" PRIu64 "\n", new_id );
   }

   truxton_location_destroy(location);
   truxton_destroy(truxton);
}