I’m trying to write a C code that make a system call. I try with trivial example system("echo mouse > file.txt"). It work well but i can’t see the result from CLI. Is there the possibility to redirect the output of system to CLI?or to open a command line windows from CLI?
I haven’t tried this, but you could try something like system("DISPLAY=:0 xterm -e ’ ")
where DISPLAY is set to something appropriate to select your X server. I’d expect this to block until you closed the X terminal.
Changing the source is overkill. Also you need the “a” flag if you are going to run the command multiple times, but collect all the output in one log.
Normally one would capture standard error separately by using “2>stderror.log” (or “2>>stderror.log”) on the command line. I believe that syntax also works on Windows. Most people would just redirect both to the same file by going “> log.log 2>&1”, in Unix.
You can put them in system. As this is an Asterisk forum, I had assumed that the system call was part of the dialplan. How are you invoking the program from Asterisk?
Even then, changing standard out and standard error within a program is not normally good practice, as it removes flexibility from the person running the program.
[quote=“david55”]You can put them in system. As this is an Asterisk forum, I had assumed that the system call was part of the dialplan. How are you invoking the program from Asterisk?
[/quote]
In the system() with the program that i would like to call, I think. I’m trying to add a feature to plug-in app_conference 2.0.1.
Now I would like to call vlc that act as streaming server.
[quote=“david55”]
Even then, changing standard out and standard error within a program is not normally good practice, as it removes flexibility from the person running the program.[/quote]
I don’t see any message from the CLI of Asterisk and so i can’t understand if the software work well. After redirection i understand the problems.