using output for input

This is a discussion on using output for input within the C Programming forums, part of the General Programming Boards category; What I am doing. I am using a createprocess to run an external DOS based program that creates output (Certain ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    using output for input

    What I am doing.
    I am using a createprocess to run an external DOS based program that creates output (Certain files on a server) I want to read the output of this process back into an array in the program. Is there a way to do this without send the output of the first process to a file then reading the contents of that file into the program.

    Thanks for any suggestions.

  2. #2
    eh ya hoser, got a beer? stumon's Avatar
    Join Date
    Feb 2003
    Posts
    323
    Instead of writing the info to a file, create a struct with what ever members you want, then malloc() the memory needed for the output. You could create a linked list of all the info, depending on what type of info it is.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    3
    The output I would get if I ran the first process independantly is below. Basically it is a lis of Videos in a Video Library. SO what I am doing is creating a process that runs the dvlutil query * /B. I want to take the output of that and put it into an array. Does that make sense?

    C:\>dvlutil query * /B
    AABGETXX
    AABJDJBP
    ACAEUWHP
    ACGXWHYP
    ACGXWHYQ
    ACGYGQOV
    ACGYGQPZ
    ACGYGQQH
    ACGYGQQQ
    ACGYGQQW
    ACHTSEND
    ACHTSENE
    ACHTSENF
    ACHTUOLZ
    ACHTVJED
    ACHTZHFL
    ACHTZHFM
    ACHTZHFN
    ACHTZHFO
    ACHTZHFP
    ACHTZHFQ
    ACHTZHFS
    ACHUGBGJ
    ACHUGBGW
    ACHUGBGY
    ACHUJZIH

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    3
    I think that will work.. Thanks for the help.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    If your application is a Win32 app and not a console app, _popen() won't work - you'll have to use this. Prolly not what you need

    Just to throw another alternative out there (for thread searchers), you can use the shell to pipe the stdout of an app to the stdin of your app like "dir /s | more" - but that's just a one time thing, popen() will give you alot more flexability.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code output...
    By roaan in forum C Programming
    Replies: 6
    Last Post: 07-03-2009, 02:22 AM
  2. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 02:08 PM
  3. Replies: 4
    Last Post: 11-30-2005, 03:44 PM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 04:27 AM

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