What do you mean that you want to give commands to the console?
Are you suggesting that you want to manage colours and layout?
There is a library called "curses" that allows you to control layout and colours.
If you simply want to generate prompts and read the user responses then using stdout and stdin should suffice.
The console I need to send a command to was developed to be an interface between a network manager and a telecommunications network. The command itself will ring a buzzer in a remote location through a RF link.
I need to send this command several times in a short amount of time, so I want to write a program to do this for me.
So I need my program to communicate with the console and send it the command.
I really have no idea how to do this, so any and all help is greatly apreciated.
I really have no idea too, but here it goes my guess.
I think the console program you have is sending a message through the network to a server listening out there, so from my point of view you have two options:
1.- Trying to know the format and transport protocol for the sent message (examining the code, with a sniffer) and write a program that can send a similar message
2.- Use a robot: that's a program that will capture and repeat user actions, like writing to a console.
Well, that's ok Trojan.
First I was trying to create a console, but I couldn't do even that. So can anyone tell me how can I create a Windows MS DOS console trough a C++ program.
On the other hand I really like the robot idea, but I don't know even where to start. Could you give me a hand Dian.
We need to know more about your network manager and telecoms network.
Also we need to know the command set that this "terminal" responds to.
Do you know if it is a socket based system? Does it respond to a specific protocol maybe on a specific port?
As I said, I just need to send a specific command to the console (exec ODA XXXX 1, where XXXX is the number of the buzzer I need to ring).
The console itself is started by a command in a DOS PROMPT (start wmconsole RD1), so I was thinkg about creating a DOS PROMPT and making it start the console.
As my program will be creating the PROMPT, I'll have the standard handles of the PROMPT.
These handles will be inherited by a new process created by the PROMPT (in wich case is the wmconsole).
Finally with those handles I'll probably be able input commands in the stdin of the wmconsole, making it possible to send the command to it using the WriteConsole function in windows.h.
Now we're talking!
You need a process that can start a child process and interract with it through STDIN and STDOUT.
The obvious choice is a tool called "expect" rather than "C".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.