Skip to content

Instantly share code, notes, and snippets.

@gfreezy
Created September 26, 2014 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfreezy/5daebd9ac2b916341891 to your computer and use it in GitHub Desktop.
Save gfreezy/5daebd9ac2b916341891 to your computer and use it in GitHub Desktop.
#include "tlpi_hdr.h"
int
main(int argc, char *argv[])
{
printf("Hello world\n");
write(STDOUT_FILENO, "Ciao\n", 5);
if (fork() == -1)
errExit("fork");
/* Both child and parent continue execution here */
exit(EXIT_SUCCESS);
}
@gfreezy
Copy link
Author

gfreezy commented Sep 26, 2014

./a.out
输出:
Hello world
Ciao

./a.out > /tmp/a
输出
Ciao
Hello world
Hello world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment