/* This program must have a file called 'input' in it's working directory.*/ #define _GNU_SOURCE 1 #include #include #include #include int main(void) { error_t err; size_t len; mach_port_t p = file_name_lookup ("input", 0, 0); char buf[256], * _buf = buf; len = 256; err = io_read (p, &_buf, &len, 0, len); if(err) printf("Could not read from the file (%X)\n", (unsigned)p); p = file_name_lookup_under (p, "", O_READ, 0); err = io_read (p, &_buf, &len, 0, len); if(err) printf("Could not read from the file (%X)\n", (unsigned)p); mach_port_deallocate(mach_task_self(), p); return 0; }/*main*/