Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_monolith.c
Go to the documentation of this file.
1
9#include "nilorea.h"
10
11int main(void) {
13
14 N_STR* nstr = NULL;
15
16 printf("str:%s\n", _nstr(nstr));
17
18 nstrprintf(nstr, "Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__);
19
20 printf("str:%s\n", _nstr(nstr));
21
22 nstrprintf_cat(nstr, " - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__);
23
24 printf("str:%s\n", _nstr(nstr));
25
26 free_nstr(&nstr);
27
28 nstr = new_nstr(1024);
29
30 printf("str:%s\n", _nstr(nstr));
31
32 nstrprintf(nstr, "Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__);
33
34 printf("str:%s\n", _nstr(nstr));
35
36 nstrprintf_cat(nstr, " - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__);
37
38 printf("str:%s\n", _nstr(nstr));
39
40 nstrprintf_cat(nstr, " - some more texte");
41
42 N_STR* nstr2 = nstrdup(nstr);
43
44 printf("str: %s\n str2: %s\n", _nstr(nstr), _nstr(nstr2));
45
46 N_STR* nstr3 = NULL;
47
48 nstrcat(nstr3, nstr);
49 nstrcat(nstr3, nstr2);
50
51 printf("str:%s\n", _nstr(nstr3));
52
53 nstr3 = new_nstr(10);
54
55 nstrcat(nstr3, nstr);
56 nstrcat(nstr3, nstr2);
57
58 printf("str:%s\n", _nstr(nstr3));
59
60 free_nstr(&nstr);
61 free_nstr(&nstr2);
62 free_nstr(&nstr3);
63
64 exit(0);
65}
int main(void)
#define _nstr(__PTR)
N_STR or "NULL" string for logging purposes.
Definition n_common.h:180
#define LOG_DEBUG
debug-level messages
Definition n_log.h:65
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL )
Definition n_log.c:104
#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.