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