#include #include #include #include #include #include static char *str1 = "OP1\n"; static char *str2 = "AB2\n"; int main() { int f1, f2; f1 = open ("mytmp", O_RDWR | O_CREAT | O_TRUNC, 0777); pid_t t = fork(); if (t == -1) { printf("fork failed\n"); } else if (t == 0) { write(f1, str1, strlen(str1)); } else { write(f1, str2, strlen(str2)); } // no wait, Is this ok? return 0; }