Simulate input to STDIN with EOL
<p>I am testing a method to simulate a specific input to an application.
This is the application:</p>

<pre><code>#include &lt;stdio.h&gt;

int main()
{
        int num1;
        char buffer[6] = {0};

        scanf("%d", &amp;num1);
        read(0, buffer, 6);

        printf("num1 = %d\n", num1);

        for(num1=0; num1 &lt; 6; num1++)
        {
                printf("%02X\n", buffer[num1]);
        }

        return 0;
}
</code></pre>

<p>I am trying to simulate the input using the following bash command:</p>

<pre><code>echo -ne "1337\\x0A\\x31\\x02\\x03\\x04\\x05\\x06" | ./test
</code></pre>

<p>The output I get is the following:</p>

<pre><code>num1 = 1337
00
00
00
00
00
00
</code></pre>

<p>As you can see, the buffer was not filled with values passed to the STDIN.</p>

<p><strong>EDIT:</strong>
<strong>The function below is only used to illustrate an idea of input automation in mixed i/o functions, I got this function by reverse engineering a binary file, is it possible to automate the input ?</strong></p>

<p>I appreciate your help.</p>

<p>Thanks,</p>