Difference between revisions of "Truxton option get string"
Jump to navigation
Jump to search
(Created page with "This destroys an options object. =Syntax= <syntaxhighlight lang="C"> void truxton_options_get_string( uint64_t options_handle, char const * name, char * destination_string, s...") |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | Reads a string setting. | |
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="C"> |
void truxton_options_get_string( uint64_t options_handle, char const * name, char * destination_string, size_t max_size ); | void truxton_options_get_string( uint64_t options_handle, char const * name, char * destination_string, size_t max_size ); | ||
| − | </ | + | </source> |
=Parameters= | =Parameters= | ||
| Line 24: | Line 24: | ||
=Sample= | =Sample= | ||
| − | < | + | <source lang="C" highlight="7"> |
| − | void print_starting_MFT(void) | + | void print_starting_MFT( void ) |
{ | { | ||
char folder_name[ MAX_PATH ]; | char folder_name[ MAX_PATH ]; | ||
| Line 35: | Line 35: | ||
printf( "Temporary files will be written to %s\n", folder_name ); | printf( "Temporary files will be written to %s\n", folder_name ); | ||
| − | truxton_options_destroy(options); | + | truxton_options_destroy( options ); |
} | } | ||
| − | </ | + | </source> |
Latest revision as of 14:09, 9 February 2021
Reads a string setting.
Contents
Syntax
void truxton_options_get_string( uint64_t options_handle, char const * name, char * destination_string, size_t max_size );
Parameters
options_handle
The handle to the options object created by calling the truxton_options_create function.
name
The name of the option to read.
destination_string
The string to be written to.
max_size
The maximum number of characters that can be written to destination_string
Return value
The value of the setting if specified. If the option name is not found, an empty string is returned.
Sample
void print_starting_MFT( void )
{
char folder_name[ MAX_PATH ];
uint64_t options = truxton_options_create();
truxton_options_get_string( options, "tempdir", folder_name, sizeof( folder_name ) );
printf( "Temporary files will be written to %s\n", folder_name );
truxton_options_destroy( options );
}