进程的消亡及释放资源
This commit is contained in:
28
C13-Linux系统编程/process_basic/ex.c
Normal file
28
C13-Linux系统编程/process_basic/ex.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* @brief data +%s
|
||||
* @details
|
||||
*
|
||||
* @param argc
|
||||
* @param argv
|
||||
* @return int
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
puts("Begin!");
|
||||
fflush(NULL); // !!!
|
||||
|
||||
execl("/bin/date", "date", "+%s", NULL);
|
||||
// NULL 作为参数列表的结束标志
|
||||
|
||||
// !! 如果不出错,不会到这里
|
||||
perror("execl()");
|
||||
exit(1);
|
||||
|
||||
puts("End!");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
Reference in New Issue
Block a user