APUE_1.6ProgramsAndProcesses Figure1.6PrintTheProcessID
1 /* 2 * 1.6PrintTheProcessID.cpp 3 * 4 * Created on: Feb 11, 2015 5 * Author: sunyj 6 */ 7 8 #include "../apuesunyj.h" 9 10 int main(void) 11 { 12 printf("hello world from process ID %ld\n", static_cast<long>(getpid())); 13 return 0; 14 }
1 // apuesunyj.h 2 #ifndef APUE_SUNYJ 3 #define APUE_SUNYJ 4 5 #include <errno.h> 6 #include <stdio.h> 7 #include <string.h> 8 #include <stdarg.h> 9 #include <stdlib.h> 10 #include <stdint.h> 11 #include <unistd.h> 12 13 void err_quit(const char *fmt, ...); 14 void err_sys(const char *fmt, ...); 15 16 17 #endif



![%0]JB1G$H62_GL~~CTN7]VA %0]JB1G$H62_GL~~CTN7]VA](http://images0.cnblogs.com/blog/405501/201503/071751197586981.png)
![A%C_O7_]B98A$%S2%7HNAWN A%C_O7_]B98A$%S2%7HNAWN](http://images0.cnblogs.com/blog/405501/201503/071751210707481.png)




















浙公网安备 33010602011771号