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

        
    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);

  

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