Hello,
I am wondering if I can write a C program with strings and to pass it to the system to avoid the ugly bash syntax? A simple example would be:
Code:
#include <stdlib.h>
#include <stdio.h>
/* start a virtual image with qemu-kvm */
static char command_name[2040] = {0};
int main(int argc, char** argv) {
if ( argc != 2 ) {
fprintf(stderr, "Provide command line argument for virtual image \n");
exit(1);
} else {
sprintf(command_name, "qemu-kvm -m 1024 %s -netdev user,id=user.0 -device rtl8139,netdev=user.0",
argv[1]);
}
return system(command_name);
}
I don`t need big scripts just for few commands.