Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are mixing the two concepts of arguments and piping.</p> <p>The parameters that you specify in the <code>main</code> function handles arguments, not piping.</p> <p>The "pipe" character <code>|</code> is used to do piping, and that doesn't affect the arguments, it affects the input and output stream. The <code>&lt;</code> and <code>&gt;</code> can be used to pipe from and to a file.</p> <p>What you append after a program call is arguments, example:</p> <pre><code>progam.exe arg1 arg2 arg3 </code></pre> <p>These will be parsed by the bolerplate code in the program, and end up in the <code>argv</code> array when the <code>main</code> function is called.</p> <p>When you use the <code>&lt;</code> character to pipe a file into a program, the content of the file will be sent to the input stream of the program:</p> <pre><code>program.exe &lt; data.txt </code></pre> <p>The program will not have console input (screen and keyboard), instead it's fed data from the file.</p> <p>When you use the <code>&gt;</code> character to pipe to a file, the output of the program goes to the file instead of the console. Example:</p> <pre><code>program.exe &gt; result.txt </code></pre> <p>When you use the <code>|</code> character to pipe from one program to another, the output stream of the first program is the input stream of the other program. Example:</p> <pre><code>program.exe | sort.exe </code></pre> <p>Everything that the first program writes to the output stream goes into the input stream of the other program. If you don't specify any input or output files, the first program has console input, and the second program has console output. So, the data flows through the two programs like this:</p> <pre><code>[console] --&gt; [program.exe] --&gt; [sort.exe] --&gt; [console] </code></pre> <p>You can pipe several programs, so that the data flows from the first program to the last. Example:</p> <pre><code>program.exe | sort.exe | more.exe </code></pre> <p>The data then flows throught all three programs:</p> <pre><code>[console] --&gt; [program.exe] --&gt; [sort.exe] --&gt; [more.exe] --&gt; [console] </code></pre> <p>(The <code>.exe</code> extension is normally not needed when specifying a program, I just included it here to distinguish clearly between programs, arguments and files.)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload