I use nativeprocess api in AIR to launch a c++ console app. The console app runs correctly but does not appear, but I want it to be visible and user be able to interact with it. How can I achieve that?
Instead of launching your executable directly, you'll need to launch your platform's terminal application (on Windows, that's CMD.exe, on OS-X it's Terminal.app, and on unix/linux it's xterm).
By default, the terminal application will run an interactive shell prompt, but you can use command-line arguments to tell it to execute any other program instead. In this case, you'll want to tell it to execute your C++ console application.
On Windows, this might look something like this:
CMD.exe /K C:\path\to\your\app.exe
on OS-X, it's a little more complicated. Here's a related S.O. post ( Running a command in a new Mac OS X Terminal window)
Related
I have a c++ windows application that runs via a GUI. I made a CLI for it to automate some things and this works fine if I use
AllocConsole();
or even
AttachConsole(PID);
as long as it is attaching to a windows CMD terminal.
I want to attach to a Cygwin terminal so I can use Expect to automate some things, but attach console always fails here and results in errors when trying to write to it.
Does anyone know how to make a windows application attach to a Cygwin terminal like this?
Not all cygwin terminals use the windows console. If you are not using a windows console then AttachConsole simply will not help you.
In particular a mintty.exe terminal will not work with AttachConsole because it is not a windows console.
I use vscode for writing and executing my C++ programs, I use the integrated terminal in vscode for compiling & running the programs(using coderunner) but I want to run my programs in the Windows terminal by default each time I run the program in vscode. Can anyone please help me out with this ?
If you want to use Windows Terminal more easily, you can open Windows Terminal in quake mode. The keybind is win+` by default. This could avoid using the integrated terminal at all, if you prefer.
You could also use the integrated terminal to pass your command to Windows Terminal. Replace ping learn.microsoft.com with the command you want to execute. You can then send build and run commands to Windows Terminal with wt.exe:
wt ping learn.microsoft.com
Alternatively, you can configure debugging behavior for when you press F5. First, configure launch.json to launch your configured external terminal:
"console": "externalTerminal",
Then configure VS Code settings to set the external terminal for your OS in settings.json:
"terminal.external.windowsExec": "wt.exe",
I was wondering how can I make a Push Button in OS X run a Terminal command when clicked.
the command is networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4.
If your coding in an objective-c project option for mac osx in xcode, you can just throw in a system("Arg"); command inside an IBaction. You can mix c code inside objective-c projects without any effort.
system("networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4");
I've used NSTask in the past to run shell commands in objective-c. It may or may not be useful to you.
I'll even link a tutorial
This is assuming you have a button setup to use either an IBAction or a target/action pair.
I need to run a console when the app starts (for debug, log, etc) without a .bat file.
I use the LCC compiler on Windows 7 x86.
Look at the console APIs in Windows, start with AllocConsole.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010%28v=vs.85%29.aspx
I need a terminal Widget which is able to emulate a windows console and a simple VT100 terminal on Windows. Something like VTE for GTK or QConsole for QT.
Is it even possible to run a Windows Console like cmd.exe inside a child window?
Usually a "console" or Terminal hooks up at a rs-232 interface. cmd.exe is AFAIK a native application only acting like a command line interpreter. Therefor you will not be able to use it in an child window.
Do you need a terminal emulator that communicates with a VT100? If so, there are tons of out there. If you want to write your own Interface take a look at the
Windows PowerShell API.
Another great Open Source Project for achieving something you want is PuTTY for Windows under MIT License. You could communicate with the VT100 using Telnet. The Windows Telnet client should be accessible using PowerShell.
Just call AllocConsole to create your own console window. You can use the normal console mode CRT functions to read and write from/to it. A more GUI friendly approach would be to just create a window with a multi-line readonly Edit control with a fixed-pitch font.