most of my programming in C is done with Posix or µC-Stuff so maybe this is just trivial:
I need for a Visual Studio 2005 C++ project something like an scriptable ssh/telnet module which only uses ssh or telnet as external tool.(so please no suggestions to TST10.exe or something, i know that but that works not very well in my case). I know which commands i need to write into that console and i know what answer comes. Status is:
+ I can create a Process with CreateProcess(...) and grap it's STDOUT and STDIN into pipes with STARTUPINFO given as parameter.
+ if i use this to start a simple exe like a hello world i can read the output "Hello World!" with ReadFile(...)
- How can i stop reading from that pipe after one single line?
- Can this be done with the mentioned functions?
- do i need to close the pipe after every line or stuff?
I have build a little tool which prints one line and than waits for a newline before printing next line. If i call this instead of hello-world ReadFile never returns (even if i set the receive buffer to size 1)