Pergunta

I'm currently writing an application that I would like to open in a new terminal window, resizing it in the process, rather than the one in which the invoking command was typed. How should I go about doing this? I'm using the gnome terminal and will be writing the app in C++.

Foi útil?

Solução

Try gnome-terminal --geometry="20x10" -e 'command' (20 is height, 10 is width).

In C++, you can call a command by using system().

Outras dicas

There is no pure C++ way to do this. What you are wanting to do is inherently system dependent, so you have to use system() defined in cstdlib.

You can call this as:

    system("<your-shell-command> <parameters>"); 

For e.g.,

    system("/usr/bin/gnome-terminal /usr/executables/a.out"); 

or

    system("C:\\Windows\\cmd.exe C:\\Users\FuUser\\Binaries\a.exe"); 

If you are doing this from the Linux console you want openvt:

http://www.oreillynet.com/linux/cmd/cmd.csp?path=o/openvt

If you are talking about a terminal window under X you can usually use a command like

gnome-terminal -e "command"
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top