All of the fileref functions are now implemented:
[projects/chimara/chimara.git] / src / model.c
1 #include "glk.h"
2
3 static winid_t mainwin = NULL;
4
5 void glk_main(void)
6 {
7     /* Open the main window. */
8     mainwin = glk_window_open(0, 0, 0, wintype_TextBuffer, 1);
9     if (!mainwin) {
10         /* It's possible that the main window failed to open. There's
11             nothing we can do without it, so exit. */
12         return; 
13     }
14     
15     /* Set the current output stream to print to it. */
16     glk_set_window(mainwin);
17     
18     unsigned char buffer[255];
19     int i;
20     for(i = 0; i < 255; i++)
21         buffer[i] = glk_char_to_upper(i + 1);
22     
23     glk_put_string("Philip en Marijn zijn vet goed.\n");
24     glk_put_string(buffer);
25     
26     frefid_t f = glk_fileref_create_by_prompt(fileusage_TextMode, filemode_Write, 0);
27     if( glk_fileref_does_file_exist(f) )
28         glk_put_string("\n\nFile exists!\n");
29     else
30         glk_put_string("\n\nFile does not exist!\n");
31     glk_fileref_destroy(f);
32
33         /* Bye bye */
34         glk_exit();
35 }