CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867

    Re: Read Dos Out put

    Strangely enough I needed to do this today! I was running a DOS applicartion that was printing some error message in its console and then immediately aborting (taking the console down with it). Let's say your DOS app is called "app" and you want to see its output in a file called "file.txt". Just run the application from a command prompt by typing app > file.txt You'll then be able to open file.txt in any text editor and view the output. There's probably a way to do this programmatically too but I don't know what it is.

    The '>' symbol BTW is called a pipe if I remember correctly.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Read Dos Out put

    Quote Originally Posted by John E View Post
    The '>' symbol BTW is called a pipe if I remember correctly.
    I always thought that pipe is '|'.

    And passing "app > file.txt" in the CreateProcess won't work.
    See http://www.codeguru.com/forum/showpo...5&postcount=10
    Victor Nijegorodov

  3. #18
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867

    Re: Read Dos Out put

    Quote Originally Posted by VictorN View Post
    I always thought that pipe is '|'.
    Yes, you could be right. Pipes, filters and redirection. It's a all a long time ago but I remember that '>' was one of them..!
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  4. #19
    Join Date
    Oct 2010
    Posts
    68

    Re: Read Dos Out put

    Code:
    system("dir >> myfile.txt");
    This would accomplish the goal, you could then use the text file to parse the results. Maybe not the best way though.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured