Rusty's code
@Dying in the rain.
摘要: 一、前言:要在程序中启动某一程序,如果程序已经存在了,就不再启动。查找了N篇文档,有所收获,总结一下。二、实现大体分两种:1、exec或popen执行ps的命令行,然后运用某几个字符串匹配函数。#include <stdio.h>#include <unistd.h>#include <string.h>#include <signal.h>int main(){ FILE *pstr; char cmd[128],buff[512],*p; pid_t pID; int pidnum; char *name= "ping"; 阅读全文
posted @ 2011-04-14 19:53 Rusty's code 阅读(15872) 评论(4) 推荐(0) 编辑