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++.
Try gnome-terminal --geometry="20x10" -e 'command'
(20 is height, 10 is width).
In C++, you can call a command by using system() .
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 eg,
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"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.