Getting return value of another process

This is a discussion on Getting return value of another process within the Windows Programming forums, part of the Platform Specific Boards category; I have a file where I scan each line for a certain word and return any line that contains it. ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    22

    Getting return value of another process

    I have a file where I scan each line for a certain word and return any line that contains it. Instead of scanning through the entire file, I am trying to just use 'findstr' from the command line. I know you can call commandline functions using system() or CreateProcess, however I'm not sure how I would get the output from findstr back into my program.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    Try popen()
    Or _popen() as microsoft calls it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Code:
    DWORD dwExitCode;
    WaitForSingleObject(hProcess, INFINITE);
    GetExitCodeProcess(hProcess,&dwExitCode);
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  4. #4
    Registered User
    Join Date
    Jul 2005
    Posts
    22
    Thanks salem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  2. Another weird error
    By rwmarsh in forum Game Programming
    Replies: 4
    Last Post: 09-24-2006, 10:00 PM
  3. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 01:39 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 11:54 AM

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