码迷,mamicode.com
首页 > 其他好文 > 详细

读取一个文件中哪一行 的一个参数

时间:2016-04-05 15:33:07      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:

        
    FILE *file = NULL;
        char line[255];
	char buf[255];
	memset(buf,0,sizeof(char)*255);
	memset(line,0,sizeof(char)*255);
	file = popen("sed -n ‘2p‘ /hong | cut -d= -f2", "r");
	if(file!= NULL)
	{
		if (fgets(line, 255, file) == NULL)
		{
			mg_printf(conn, "err1");
			pclose(file);
			return;
		}
	}
	pclose(file);

  

读取一个文件中哪一行 的一个参数

标签:

原文地址:http://www.cnblogs.com/hongzhunzhun/p/5354815.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!