C++ input and output files
<p>So im writing c++ program, that takes a integer from input file, multiply it with 2 and outputs it on output file. So the code is - </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
using namespace std;

int main() {
    int n;
    FILE * inFile;
    FILE * outFile;
    inFile = fopen ("reiz.in","r");
    outFile = fopen ("reiz.out","r+");
    fscanf (inFile, "%s", n);
    int m = n * 2;
    fprintf (outFile, "%n", n);
    fclose (inFile);
    fclose (outFile);
    return 0;
}
</code></pre>

<p>But something is wrong. in reiz.in file there is number 2, after running program it should output 4 in reiz.out, but it just shows don't send error. What exactly is wrong with my script?
Best regards,
Y2oK</p>

<p>EDIT 1: Ok now it looks like this - </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
using namespace std;

int main() {
    int n;
    FILE * inFile;
    FILE * outFile;
    inFile = fopen ("reiz.in","r");
    outFile = fopen ("reiz.out","r+");
    fscanf (inFile, "%d", &amp;n);
    int m = n * 2;
    fprintf (outFile, "%d", m);
    fclose (inFile);
    fclose (outFile);
    return 0;
}
</code></pre>

<p>but still it gives same don't send error when running reiz.exe file, and it doesn't write anything on output file
I'm now a little bit confused, and don't know who to chose as best answer, so I will chose the one who got most "+1". But thanks to all!</p>
