Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
161 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* CONFIG EXAMPLE: Using my terribly built ini reader/writer */ | ||
|
||
#include <astera/asset.h> | ||
#include <astera/debug.h> | ||
#include <astera/sys.h> | ||
#include <time.h> | ||
|
||
// add "INI:" to the start of debug outputs | ||
char* log_prepend(void) { | ||
return "INI: "; | ||
} | ||
|
||
int main(void) { | ||
// add the prepend function to add before output lines | ||
d_set_format_func(log_prepend); | ||
|
||
s_table table = s_table_create(256, 32, 1); | ||
s_table_add_int(&table, "souls", 42); | ||
|
||
// Write to file | ||
s_table_write(&table, "test.ini"); | ||
// Free in memory copy | ||
s_table_free(&table); | ||
|
||
// Get the file data | ||
asset_t* table_data = asset_get("test.ini"); | ||
|
||
// Read file | ||
table = s_table_get(table_data->data); | ||
|
||
_l("souls: %s\n", s_table_find(&table, "souls")); | ||
|
||
s_table_free(&table); | ||
asset_free(table_data); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.