Re: Problems piping input into program

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: muchan (muchan_at_promikra.si)
Date: 03/24/04

  • Next message: Gary Chang: "RE: Please Help! Tab control without mfc"
    Date: Wed, 24 Mar 2004 14:27:56 +0100
    
    

    William Payne wrote:
    > Hello, I am using Visual C++ 2003 and I can't seem to pipe input into my
    > Win32 console program (written in C). Under Project->Properties I have added
    > "< data.txt" (without the quotes) to Configuration
    > Properties->Debugging->Command Arguments.
    > The file data.txt is located in where my source files are. When I try to run
    > the program, a dialog box says:
    > Unable to start debugging.
    > Unable to start program
    > 'c:\coding\c\infixtopostfix_vc7.1\debug\infixtopostfix_vc7.1.exe
    > Output cannot be redirected because the specified file is invalid.
    >
    > If I remove "< data.txt" the program starts, but then I don't get the
    > desired input.
    >
    > I can, however, start from the command line when piping input.
    >
    > What am I doing wrong?
    >
    > / WP
    >
    >

    Properties->Debugging->Command Arguments sets the argument, so that you
    get the strings as args list in main() function, or as the lpCmdLine
    parameter in WinMain() function. What program use the argument list
    string is up to responsibility of the programmer, so if you don't do
    anything with that, your program doesn't do anything redirecting
    the file to stdin.

    I think redirect with '<' is treated by command line shell, so,
    you should first write interactive program with stdin as input,
    debug it interactively, then test it with redirct from coonsole window.
       (you can debug it by putting debug strings to stdout,
        the way all the programmer were debugging in good old days..)

    muchan


  • Next message: Gary Chang: "RE: Please Help! Tab control without mfc"

    Relevant Pages

    • Re: Invalid attempt to read when no data is present
      ... Odd that you can debug with the code you posted. ... SqlDataReader that takes 2 strings as parameters. ... "Andy Sutorius" wrote in message ... > "Kevin Spencer" wrote in message ...
      (microsoft.public.dotnet.framework.aspnet)
    • Any more ideas? -- RE: How to debug binary-only modules and binaries
      ... Thanks for your reply, but I've tried strings, objdump, gdb and several ... --Guolin Cheng ... How to debug binary-only modules and binaries ...
      (Fedora)
    • Re: Deugging release build of MFC app
      ... I was hoping someone could shed some light on what's required to debug a release build of an MFC application in Visual Studio 2003. ... I see that the default configuration for Release builds includes debug symbols, but when I step through the code, the values I see in the watch window don't jive with their "actual" values. ... Another aid is to format strings and send them to OutputDebugString instead of to a message box. ... The strings appear in the debugger output window without stopping execution flow. ...
      (microsoft.public.vc.mfc)
    • Re: package installation fails with error code 1
      ... >Conrad J. Sabatier wrote: ... >It says I have to check out the debug screen - but when I go to debug ... that only works when you boot into sysinstall. ... You could try duplicating (not just redirecting, ...
      (comp.unix.bsd.freebsd.misc)
    • Re: Debug TRACE style output wihout leaving literal strings in binary
      ... create a tool that would spit out stripped source code (which you would then ... and an RC file containing all the TRACE strings. ... > I want the developers to continue writing easy to use TRACE type debug ... >>> after compilation, but will be transparent to compilation. ...
      (microsoft.public.vc.debugger)