Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Inputting into another program (C/C++)

Name: Anonymous 2007-01-12 9:16

So, how do you do it? I'm trying to create a NetHack character generator, but for that I need my program to input text into it in a predetermined way. Everything I read about interprocess/interprogram communication is far too complex for what I need, I'd rather start slowly and then go building up the concepts. Finally, cheating is not my main concern here (changing the source would be much easier), learning is, so don't go crazy because I asked!

Name: Anonymous 2007-01-12 10:34

>>1
If I understood correctly, you want a program that will act as the client of another, as if you were typing stuff into this other program? This can be simple to complex, depending on how's that other program. Is it a text-based program (runs in a terminal, or command prompt window) and you don't mind exiting it at the end of your program, or you need to let the user take over the commanded program afterwards? Do you need to read what the other program says, or you can send everything blindly?

Save for a very simple case where you could use the standard output, IPC is out of the question as it has to be supported by both processes, i.e. the commanded process would have to support it. At worst you'll have to call some operating-system dependent functions to simulate user input right into the target process' input buffer.

But where does NetHack write your characters? It's 95% likely that the simplest solution to generate characters would be to generate or edit a savegame, not to control another process while it's running.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List