/* * system call API hello world */ #include #include #include #include main() { char buf[1000]; int i; write (STDOUT_FILENO, "hello world! please input: \n", strlen("hello world! please input: \n")); dup(0); /* i = read (0, buf, 1000); */ close(0); scanf("%s", buf); printf("after scanf buf = %s\n", buf); dup(3); scanf("%s", buf); printf("after second scanf buf = %s\n", buf); write(1, "the input is: ", 14); write(1, buf, strlen(buf)); }