Nilorea Library
C utilities for networking, threading, graphics
All Data Structures Files Functions Variables Typedefs Enumerations Macros Modules Pages
ex_monolith.c

Nilorea Library monolith api test.

Nilorea Library monolith api test

Author
Castagnier Mickael
Version
1.0
Date
26/05/2015
#include "nilorea.h"
int main(void) {
N_STR* nstr = NULL;
printf("str:%s\n", _nstr(nstr));
nstrprintf(nstr, "Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__);
printf("str:%s\n", _nstr(nstr));
nstrprintf_cat(nstr, " - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__);
printf("str:%s\n", _nstr(nstr));
free_nstr(&nstr);
nstr = new_nstr(1024);
printf("str:%s\n", _nstr(nstr));
nstrprintf(nstr, "Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__);
printf("str:%s\n", _nstr(nstr));
nstrprintf_cat(nstr, " - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__);
printf("str:%s\n", _nstr(nstr));
nstrprintf_cat(nstr, " - some more texte");
N_STR* nstr2 = nstrdup(nstr);
printf("str: %s\n str2: %s\n", _nstr(nstr), _nstr(nstr2));
N_STR* nstr3 = NULL;
nstrcat(nstr3, nstr);
nstrcat(nstr3, nstr2);
printf("str:%s\n", _nstr(nstr3));
nstr3 = new_nstr(10);
nstrcat(nstr3, nstr);
nstrcat(nstr3, nstr2);
printf("str:%s\n", _nstr(nstr3));
free_nstr(&nstr);
free_nstr(&nstr2);
free_nstr(&nstr3);
exit(0);
}
#define _nstr(__PTR)
N_STR or "NULL" string for logging purposes.
Definition n_common.h:182
#define LOG_DEBUG
debug-level messages
Definition n_log.h:64
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL )
Definition n_log.c:91
#define free_nstr(__ptr)
free a N_STR structure and set the pointer to NULL
Definition n_str.h:176
#define nstrcat(__nstr_dst, __nstr_src)
Macro to quickly concatenate two N_STR.
Definition n_str.h:102
N_STR * nstrdup(N_STR *str)
Duplicate a N_STR.
Definition n_str.c:670
#define nstrprintf_cat(__nstr_var, __format,...)
Macro to quickly allocate and sprintf and cat to a N_STR.
Definition n_str.h:98
N_STR * new_nstr(NSTRBYTE size)
create a new N_STR string
Definition n_str.c:180
#define nstrprintf(__nstr_var, __format,...)
Macro to quickly allocate and sprintf to N_STR.
Definition n_str.h:94
A box including a string and his lenght.
Definition n_str.h:39
Header for a monolith use.