APUE_1.6ProgramsAndProcesses Figure1.6PrintTheProcessID

%0]JB1G$H62_GL~~CTN7]VA

A%C_O7_]B98A$%S2%7HNAWN

 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
", 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

IMG_1272IMG_1273IMG_1274

IMG_1275

IMG_1276IMG_1277IMG_1278IMG_1279

IMG_1280IMG_1281IMG_1282IMG_1283

IMG_1284IMG_1285IMG_1286IMG_1287IMG_1288

IMG_1289

IMG_1290IMG_1291

原文地址:https://www.cnblogs.com/sunyongjie1984/p/4285255.html