Rune - Further Object abstraction work
[rune.git] / tests / file2.d
1 #!/usr/local/bin/rune -x
2 #
3 # Test low-level file ops
4
5 import "sys";
6 import <stdio>;
7
8 typedef stdio.File File;
9
10 int
11 main(int ac, string_p *av)
12 {
13     File @fp;
14
15     stdio.stdout->show("A");
16     stdio.stdout->show("B");
17     fp = File.fdopen(1Z, "r+");
18     stdio.stdout->show("C");
19     fp->show("YWASHERE");
20     stdio.stdout->show("E");
21     fp->fwrite("abcd\n", 5);
22     fp->fflush();
23     stdio.stdout->show("F");
24     fp->fwrite("efgh", 4);
25
26     # destructor should flush fp
27     #
28     fp = NULL;
29 }