25 lines
497 B
C
25 lines
497 B
C
|
|
#include <blue/core/stringstream.h>
|
||
|
|
#include <blue/object/string.h>
|
||
|
|
#include <stdio.h>
|
||
|
|
#include <stdlib.h>
|
||
|
|
|
||
|
|
int main(void)
|
||
|
|
{
|
||
|
|
b_string *str = b_string_create_from_cstr("Hello, world!\n");
|
||
|
|
b_string_insert_cstr(str, "WOW!", 4);
|
||
|
|
|
||
|
|
printf("%s\n", b_string_ptr(str));
|
||
|
|
|
||
|
|
b_string_release(str);
|
||
|
|
|
||
|
|
b_stringstream strv;
|
||
|
|
b_stringstream_begin_dynamic(&strv);
|
||
|
|
b_stringstream_add_many(&strv, "Hello", ", world", "!", NULL);
|
||
|
|
char *s = b_stringstream_end(&strv);
|
||
|
|
|
||
|
|
printf("%s\n", s);
|
||
|
|
free(s);
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|