 <p>You probably want to pad it with 0 bytes. Fill your newtitle buffer with zeroes before copying the string into it, then write that buffer to the file:</p> <pre><code>char newtitle[80]; memset(newtitle, '\0', 80); strncpy(newtitle, title, 80); fwrite(newtitle, sizeof(char), 80, fp); </code></pre> <p>You can pass whatever ASCII character you want into memset(), to pad it with. But with binary files you'll generally use <code>'\0'</code>.</p>