Interpreting '\n' in printf("%s", string)
<p>This piece of code is acting a bit strange to my taste. Please, anyone care to explain why? And how to force '\n' to be interpreted as a special char?</p>

<pre><code>beco@raposa:~/tmp/user/foo/bar$ ./interpretastring.x "2nd\nstr"
1st
str
2nd\nstr
beco@raposa:~/tmp/user/foo/bar$ cat interpretastring.c
#include &lt;stdio.h&gt;

int main(int argc, char **argv)
{
    char *s="1st\nstr";

    printf("%s\n", s);
    printf("%s\n", argv[1]);

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

<p>Bottom line, the intention is that the 2nd string to be printed in two lines, just like the first. This program is a simplification. The real program has problems reading from a file using <code>fgets</code> (not a S.O. argument to <code>argv</code> like here), but I think solving here will also solve there.</p>