How to write and read (including spaces) from text file <p>I'm using <code>fscanf</code> and <code>fprintf</code>.</p> <p>I tried to delimit the strings on each line by <code>\t</code> and to read it like so:</p> <pre><code>fscanf(fp,"%d\t%s\t%s",&amp;t-&gt;num,&amp;t-&gt;string1,&amp;t-&gt;string2); </code></pre> <p>The file contents:</p> <pre><code>1[TAB]string1[TAB]some string[NEWLINE] </code></pre> <p>It does not read properly. If I <code>printf("%d %s %s",t-&gt;num,t-&gt;string1,t-&gt;string2)</code> I get:</p> <pre><code>1 string1 some </code></pre> <p>Also I get this compile warning:</p> <pre><code>warning: format specifies type 'char *' but the argument has type 'char (*)[15]' [-Wformat] </code></pre> <p>How can I fix this without using binary r/w?</p>