Why, when I use fwrite(), does it automatically append a new line to the end of my string?

Here's my code:


 if ((strlen($fc) + strlen($safe_mesg)) > TOTAL_MAXCHR)
  $fc = $safe_mesg;
 else
  $fc = sprintf("%s %s", $fc, $safe_mesg);

 print "DEBUG: fc is $fc";

 fwrite($fp, $fc);

 fclose($fp);

The debug output confirms that $fc has no NL.

However, when I open the output file, there's a new line after the string.

    fwrite() shouldn't print any characters except those you fed to it.

    But in case you work under Windows, this note from the manual may help:

    Note: On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen() mode parameter.

      Write a Reply...