Red de conocimiento informático - Problemas con los teléfonos móviles - Llamada al sistema cmd, cómo capturar información de error

Llamada al sistema cmd, cómo capturar información de error

#includelt;stdio.hgt;

#includelt;stdlib.hgt;

#includelt;err.hgt;

#define BUF 256

int

main (int argc, char *argv[])

{

ARCHIVO *fp

char buf; [BUF];

int bandera = 0;

//char *cmdline = "/bin/ls -luasx /bin"; = "busybox ftpget -u sgq1 -p sgq123 10.41.181.207 chin.c chin.c";

if ( (fp=popen(cmdline, "r")) ==NULL) {

err(EXIT_FAILURE, "s", cmdline);

}

while(fgets(buf, BUF, fp) != NULL) {

(nulo) fputs(buf, stdout);

bandera = 1;

}

(nulo) pclose(fp);

salir (EXIT_SUCCESS);

}