Difference between revisions of "Truxton options create"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This creates an options object. This is how you get configuration settings from Truxton. =Syntax= <syntaxhighlight lang="C"> uint64_t truxton_options_create(void); </syntaxhi...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This creates an options object.
 
This creates an options object.
This is how you get configuration settings from Truxton.
+
This is how you get configuration settings from Truxton's [[Configuration System|configuration system.]]
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
uint64_t truxton_options_create(void);
+
uint64_t truxton_options_create( void );
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
Line 14: Line 14:
  
 
=Sample=
 
=Sample=
<syntaxhighlight lang="C" highlight="3">
+
<source lang="C" highlight="3">
 
void process_free(void)
 
void process_free(void)
 
{
 
{
 
   uint64_t options = truxton_options_create();
 
   uint64_t options = truxton_options_create();
  
   if ( truxton_options_get_boolean("pfree") == 1 )
+
   if ( truxton_options_get_boolean( "pfree" ) == 1 )
 
   {
 
   {
 
       printf( "Yes, we will process free space\n" );
 
       printf( "Yes, we will process free space\n" );
Line 28: Line 28:
 
   }
 
   }
  
   truxton_options_destroy(options);
+
   truxton_options_destroy( options );
 
}
 
}
</syntaxhighlight>
+
</source>

Latest revision as of 14:06, 9 February 2021

This creates an options object. This is how you get configuration settings from Truxton's configuration system.

Syntax

uint64_t truxton_options_create( void );

Parameters

None.

Return value

A handle to an options object.

Sample

void process_free(void)
{
   uint64_t options = truxton_options_create();

   if ( truxton_options_get_boolean( "pfree" ) == 1 )
   {
      printf( "Yes, we will process free space\n" );
   }
   else
   {
      printf( "No, we will not process free space\n" );
   }

   truxton_options_destroy( options );
}