Input redirection in gdb (MinGW)

后端 未结 3 1878
广开言路
广开言路 2020-12-03 13:57

I\'m trying to get gdb to run programs with input redirection to stdin. For example, without gdb I would run a program like this:

prog < input.txt
         


        
3条回答
  •  没有蜡笔的小新
    2020-12-03 14:09

    I ran into the same issue here, and I just got into the habit of adding a command-line argument to allow grabbing input from a file.

    e.g. Parsing a "-i ifile" argument using argc and argv to get input from ifile instead of stdin and parsing a "-o ofile" to write output to ofile instead of stdout.

    Then I just use those arguments instead of redirects.

    The tools that come with MinGW often are not the latest versions and often have features omitted. ::shrug::

提交回复
热议问题