snippet template "Creates a template for a c file"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char** argv){
	$1
	return 0;
}
endsnippet

snippet pr "Printf template"
printf("$1\n");
endsnippet

snippet gtk "Main gtk template"
#include <stdio.h>
#include <gtk/gtk.h>

int main(int argc, char *argv[])
{
    GtkBuilder      *builder; 
    GtkWidget       *window;
    GtkCalendar       *calendar;

    gtk_init(&argc, &argv);

    builder = gtk_builder_new();
    gtk_builder_add_from_file (builder, "`ls *.glade`", NULL);

    window = GTK_WIDGET(gtk_builder_get_object(builder, "calChoose"));
    gtk_builder_connect_signals(builder, NULL);

    g_object_unref(builder);

    gtk_widget_show(window);                
    gtk_main();

    return 0;
}

// called when window is closed
void on_main_window_destroy()
{
    gtk_main_quit();
}

void on_calendar_selected(GtkButton* Button,GtkCalendar* calendar)
{
    guint day;
    guint month;
    guint year;
    gtk_calendar_get_date(GTK_CALENDAR(calendar), &year, &month, &day);
    printf("%d-%d-%d\n", year, month, day);
    gtk_main_quit();
}
endsnippet


snippet fgets "fgets function from stdio.h"
fgets(${1:char* s}, ${2:int size}, ${3:FILE* stream});
endsnippet

snippet sscanf "sscanf function stdio.h"
sscanf(${1:const char *str}, ${2:const char *format}, ${3:...});
endsnippet

snippet DML "define maxlinelength"
#define MAXLINELEN 30000
endsnippet

snippet ML "maxlinelength"
MAXLINELEN
endsnippet


