title: How do I pass input as an argument when I'm in the gdb shell?
body: <p>So hypothetical case here, let's say I have to programs named:</p>
  
  <p>prog1.c</p>
  
  <p>prog2.c</p>
  
  <p>Now, prog1.c is first compiled and ran as this:</p>
  
  <pre><code>gcc -Wall prog1.c
  ./a.exe 20 5 &gt; out
  </code></pre>
  
  <p>So now I have an output file called "out" that is read in binary. Now, I need to take in the file into prog2.c, so I normally do so:</p>
  
  <pre><code>gcc -Wall prog2.c
  ./a.exe 3 2 &lt; out 
  </code></pre>
  
  <p>The problem here is that I'm running into pretty bad problems with prog2.c and I need to use gdb to debug it. The problem here is that whenever I try to pass in the out file, gdb just doesn't let me.</p>
  
  <pre><code>Reading symbols from ./a.exe...done.
  (gdb) r 3 1 &lt; out
  Starting program: /drives/C/Users/XX/XXXXX~1/a.exe 3 1 &lt; out
  [New Thread 4632.0x83c]
  [New Thread 4632.0x1f40]
  Usage: prog2 sort-field [sort-type]
  
  [Inferior 1 (process 4632) exited with code 01]
  </code></pre>
  
  <p>gdb seems to keep stopping whenever I try to pass in the out file and gives me the Inferior 1 (process 4632) error. Is there a way I can pass this in properly?  I tried using set args and it didn't work (or maybe I did it wrong). </p>
  
  <p>Thanks</p>