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-13 17:13 (sage)

>>10
Here's an improved version (who would have guessed that this would work):
#!/usr/bin/expect -f
while true {
    spawn /usr/bin/nethack -uAnonymous-Hum-Mal-Neu-Wiz
    send "\x1b\x1b\x1b"
    send "i"
    expect {
        -re "spellbook of create monster.*ring of slow digestion" break
        "(end)" { send " "; send "#qyq"; close }
    }
}
interact

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