Search code examples
cunixexecxterm

How to get Command line arguments for xterm in C?


My code is as follows to open a xterm terminal and run the ./paramax executable

#include <unistd.h>
#include <sys/ipc.h>

int main(int argc, char* argv[])
{
execl("/usr/bin/xterm", "/usr/bin/xterm", "-hold", "./paramax", (void*)NULL);
return 0;
}

Now the problem is for ./paramax I need to give a commandline argument for it to execute. How to proceed with this?


Solution

  • Run xterm -e ./paramax arg and more args, either directly or through an exec call.