#!/usr/local/bin/rune -x # # Simple reading. Test the Rune feature which allows the casting of # pointers to (void *) as long as the target object does not contain # any pointers or lvalues. # import "sys"; import ; class MyBuf { char buf[512]; char x[4]; # resolver should fail if the structure contains a pointer. # #char *y; } int main(int ac, char **av) { MyBuf buf; size_t r; Fs fs; fs.open("/usr/share/dict/words", 0, 0); for (;;) { r = fs.read(&buf, sizeof(buf)); stdio.stdout->fwrite(&buf, r); if (r <= (size_t)0) break; } return(0); }