Reading from stdout

This is a discussion on Reading from stdout within the C Programming forums, part of the General Programming Boards category; I'm trying to figure out a way to attach to a games stdout and write everything it sees to a ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    31

    Reading from stdout

    I'm trying to figure out a way to attach to a games stdout and write everything it sees to a text file. How would I go about doing this? The game is very old (around 8 years) and is called Dark Age of Camelot. It was written in C++ (dunno if that helps).

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    There's no standard way of doing it. You can redirect the output to a pipe, and then read that. How you do that depends on what platform you're on.

    In most shells you can just use the > operator to redirect the output to a file, so you don't even have to write a program for it.

    Code:
    foo > file.txt

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    I'm running windows xp x64. I've got cygwin installed as well.

    How would I do it then? It seems pretty basic but I don't know what to google.

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    You should be able to launch the program using cmd.exe. Just use the redirect operator I showed you above.

    http://technet.microsoft.com/en-us/l.../bb490982.aspx

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    The issue is, the initial camelot.exe spawns a child process game.dll, and camelot.exe then terminates. Is there a way to work around this? I've tried launching game.dll from the command line, and it works in that it asks if I want to launch another game, but it doesn't successfully do it.

    Is there a way I can attach to the initial process, and any child processes it may have?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 01-28-2008, 03:07 AM
  2. help with reading from stream
    By movl0x1 in forum C Programming
    Replies: 7
    Last Post: 05-31-2007, 11:36 PM
  3. Pipe: writing and reading.
    By apacz in forum C Programming
    Replies: 0
    Last Post: 06-07-2006, 12:12 PM
  4. Fun with reading hex
    By dpro in forum C++ Programming
    Replies: 7
    Last Post: 02-17-2006, 06:41 PM
  5. Array, reading in response etc...
    By mattz in forum C Programming
    Replies: 4
    Last Post: 12-05-2001, 11:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21