Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Because the comments have gone irreverent on you, I will make this a community wiki and commence with an interrogative-like suggestion that belongs in comments:</p> <p>Check the return values from all <code>scanf</code> calls. Do this first to determine whether the standard library API is already transmitting information to you -- via "electrostatic transmission", otherwise known as the contents of register <code>eax</code> after you call <code>scanf</code> on x86 architecture. Do not let the light in that register die unobserved. Take the register's electrical charges (bits) into a variable and compare them to both zero (0) and <code>EOF</code>. Those alien transmission were sent to you from the year 1976, when <code>scanf</code> was first written to return an informative numerical value to the caller.</p> <p>As tomlogic pointed out in comments to an answer, if you are pasting the data, you should instead try using the technique known as "input redirection" or "piping." First, get your data into a file, let's say name <em>filename.dat</em>. Then, issue a command such as the following:</p> <p><code>executable-name &lt; <em>filename.dat</em></code></p> <p>Where executable-name is the file you are generating with the C compiler. Technically, the above syntax creates an "input redirection" or "stdin redirection" -- the shell opens the file for read access as file descriptor zero (0), also know as <code>stdin</code>. The child program as spawned from the shell will <code>scanf</code> from the file, rather than the terminal (your paste buffer).</p> <p>Another approach is to create a "pipe indirection" in which the shell opens another <em>process's</em> output for reading and passes this to the child, again as <code>stdin</code> file descriptor. In this case, the shell probably uses <code>popen</code> rather than <code>open</code>. The syntax for this might be:</p> <p><code>cat <em>filename.dat</em> | executable-name</code> as if on a Unix-clone, or</p> <p><code>type <em>filename.dat</em> | executable-name</code> if in the context of an IBM&reg; PC-DOS&reg; clone.</p>
 

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