View Full Version : gnome-terminal -e ./input data.txt Closing and not running the program

January 12th, 2017, 04:49 PM

I am trying to write a CPP program to open a new gnome-terminal and run the program I wrote called input with command line argument data.txt. input works perfectly when run by its self. When I run my main it successfully opens a new terminal and runs input. input then asks me for how long to run the serial connection for, like it is supposed to, but then closes without reading in from the serial port. this only happens when using main.

main code

#include <stdlib.h>

using namespace std;

int main()
system("gnome-terminal -e ./input data.txt");
return 0;

Any thoughts on why this is and how to fix it?

p.s. sorry about the messy code.