Skip to content

Instantly share code, notes, and snippets.

@17twenty
Created January 14, 2014 18:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 17twenty/8422857 to your computer and use it in GitHub Desktop.
Save 17twenty/8422857 to your computer and use it in GitHub Desktop.
Hello World using GLib
/*
* helloglib.c
* Using glib libraries to do a hello world
* Compile with:
* gcc helloglib.c `pkg-config --cflags --libs glib-2.0` -o helloglib
*/
#include <glib.h>
int
main (void)
{
GString *my_string = g_string_new("This Hello world is %d chars long\n");
g_print(my_string->str, my_string->len);
g_string_free(my_string, TRUE);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment