I think the correct term is “piping” but I hope someone will confirm/correct this.
Essentially, I would like to set my program to open up a file in a plotting program or text editor to be viewed (so I don’t have to type it into the command line).
Is there a nice way of doing this? I have only opened and closed files so far so I am not sure where to start with opening them in a program.
Sounds like you want the Process class.
This will start the program “notepad” in a process, giving it the argument “C:\boo.txt” (which, for this example, will open that file using notepad). If all you want to do is start the program, you’re done once you have this in. If you wish to play with command line input/output, you can use the process’ streams eg:
The notepad example is Windows-specific, but the idea is the same in any case. The string passed to
exec()will be run as if it were input on the command line for the OS on your machine.