C++ new line in file not working
<p>Yesterday I post about a big contract for a new account program that must be in C++. My question closed but I think
because it had to many errors. With much work and consuling from local C++ expert I've fixed the original codes we had:</p>

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

char *main()
{
    accounting bank = 100debits;
    bank = bank + 200debits;
    return printf("bal: %accounting\n", bank);
}
</code></pre>

<p>And new version with some classes we defined works well but the only problem is C++ can't write a new line to file.
The codes below work as is but I get no output to file if I put back the comment line.</p>

<pre><code>#include &lt;stdlib.h&gt; 
#include &lt;stdio.h&gt;
#include &lt;cstring&gt;
#define accounting float
#define print_accounting(x)  x "%0.2f"
#define debits * 1.0F
#define credits * -1.0F

int main()
{
    accounting bank = 100 debits;
    bank = bank + 200 debits;
    char my_bal[((unsigned short)-1)];
    sprintf(my_bal, print_accounting("bal:"), bank);
    char write_file[((unsigned short)-1)];
    write_file[NULL] = 0;
    strcat(write_file, "@echo ");
    strcat(write_file, my_bal);
//  strcat(write_file, "\n");  -- Wont work --
    strcat(write_file, " &gt; c:\\SAP_replace\\bal.txt");
    system(write_file);
    return 0;
}
</code></pre>
