int fork();
In parent process, return pid of child
In child process, return zero
If fail return negative value
fork() : 전부 다 복사
fork1() : 호출한 현재 thread만 복사
The new program substitutes(대체) the original one
declared in <unistd.h>
int execl(const char path, const char arg0, ..., const char argn, char NULL → meaning last argument);
→ l : list
int execv(const char path, char const argv[] → 마지막은 NULL);
→ v : vector
int execlp(const char file, const char arg0, ..., const char argn, char NULL);
→ p가 붙으면 Path 자동검색
int execvp(const char file, char const argv[]);
→ p가 붙으면 Path 자동검색
int result = execvp(argv[0], argv);
if(result == -1)
fprintf(stderr, "Error! Failed to run the command\n");
pid_t wait(int *stat_loc);
➕ Parameter
stat_loc
: an integer pointer
If stateloc == NULL, it is ignored
Otherwise: receives status information from child process
➡️ Ex exit(code); // in child process ( code → stat_loc 전달 )
int sscanf(const char str, const char format, ...);
return read data #, if fail return EOF
int cnt = sscanf(expression, "%d %c %d", &operand1, &operator, &operand2);
if(cnt < 3)
return 0;
int sprintf(char str, const char format, ...);
return written data #, if fail return negative #
sprintf(out_msg.content, str); // save str
sprintf(out_msg.content, "%d", res_eval); // int to str