
By default, the installer will create a few links for using the development tools from the classical Windows Command Prompt and we are going to copy some settings from this to the Windows Terminal. In my case, I have installed the Community edition with the Desktop development with C++ workload. I will assume that you’ve already installed Visual Studio 2019 on your machine. In this article, I will show you how to use the Visual Studio command line compiler from the Windows Terminal. Too many choices to list here.Īnd also, maybe you can connect these commands with your c program using shell pipes.Solarian Programmer My programming ramblings Home Archives Contact Privacy Using the Visual Studio Developer Command Prompt from the Windows Terminal Posted on Octoby Paul To connect them back to your program, you will probably work with files, or perhaps redirecting i/o. popen trivially delivers a text stream.Ī long time ago, I used a device called 'pty' which works like a terminal, but I don't remember how to connect it usefully. I believe this will work, but I do not see how the output from the terminal command (ls in the example) would be delivered back to your program. I have not tried (lately) to launch a terminal (as suggested by smrt28), except in shell. I typically use command line parameters to tell my program which pts or extra terminals I want it to use, but environment variables, pipes, in/out redirection, and other choices exist. Issue a "cd" to set the focus to the working cd I start my program (in a different tty), and let the program know which device I want it to use for the special output (i.e. Issue the command "tty" to find out the device name, and I manually open a terminal in the conventional way, and in the terminal

On the other hand, if your output is not a simple text stream, maybe you can get by with a output-only dedicated terminal screen to accommodate special output activity. 'Fork' is another way to launch a separate process, with some control over the launched processes' std i/o, but again, I think not a terminal. Popen opens a separate process (but without a terminal to work in, just the pipe)

The popen instruction executes the command in the cmndStr, and any text written to the commands (ls -lsa) standard output, is redirected into the pipe, which is then available for your C program to read in. I use popen when the output of the (terminal) program is a text stream.

If so, you probably do not need the terminal. Your question may be somewhat misleading.īecause you want to run all the terminal commands in the c-code, perhaps you actually have only textual input / output with these commands.
