Note that there are some explanatory texts on larger screens.

plurals
  1. POOn the lack of "int main(int argc, char* argv[])" knowledge
    primarykey
    data
    text
    <p>I'm a Physicist and, usually, I just want to get the calculations done and that's all I really need. Nevertheless I had been using </p> <pre><code>int main(int argc, char* argv[]) </code></pre> <p>and its very pleasing how the binary becomes flexible in levels that I didn't expect i.e. initializing variables</p> <pre><code>~$ ./program.exe a b c (a, b and c are numbers in this case, not letters ok?) </code></pre> <p>So the question is </p> <p><strong>*How do I "parse" or "pipe" things from one to another in this manner (or other) <em>without</em> using files?*</strong></p> <p>Example: say that "a.exe" gives a set of "X-Y" points (like on a spreadsheet) and I what to plug that on "b.exe". Or say I use a bash/awk script to format the output format of "a.exe" to plot it on, say, gnuplot.</p> <p><strong>-----------------------------------------</strong></p> <p>Hi again. I'm trying to do this but, I've still got problems. </p> <p>To see what I'm doing wrong I wrote the simplest program</p> <pre><code> #include &lt;cstdio&gt; #include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std; int main(int argc, char* argv[]){ for (int i = 0; i &lt;= argc; i++) cout &lt;&lt; "argv[" &lt;&lt; i &lt;&lt; "]= " &lt;&lt; argv[i] &lt;&lt; endl; getchar(); return 0; } </code></pre> <p>and made a file with the content (lets say it is "test.dat")</p> <pre><code> 1 2 3 4 5 6 </code></pre> <p>since I don't want to read the content of the file <em>on my program</em>, I just want to "throw it" to it, so I've tried</p> <pre><code>more test.dat | ./program.exe </code></pre> <p>or even</p> <pre><code> ./program.exe &lt;&lt; EOF 1 2 3 4 5 EOF </code></pre> <p>but it doesn't work and I thought it should.</p> <p>Thanks again.</p>
    singulars
    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.
 

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