note 6085 modified in function.fputs by irchtml

From: Date: Mon, 23 Feb 2004 08:02:40 +0000
Subject: note 6085 modified in function.fputs by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-65568@lists.php.net to get a copy of this message
The way I understand fputs (which is purported as an alias to fwrite which can be "Binary Safe")... $fp = fopen("something.txt","w"); $string = "Hello World\\n"; // escape the slash from being magically // being transformed into a newline fwrite($fp, $string); // will proccess /n as newline ... fwrite($fp, $string, strlen($string)); // will write the entire string to file without changing the '/n' // into a single byte for newline on Unix-like machines or CR/LF on Win32 machines Hope this helps explain the definition of "could be Binary Safe". This is the reason why you must specify the length! --Doug --was-- The way I understand fputs (which is purported as an alias to fwrite which can be "Binary Safe")... <pre>$fp = fopen("something.txt","w"); $string = "Hello World\\n"; // escape the slash from being magically // being transformed into a newline fwrite($fp, $string); // will proccess /n as newline ... fwrite($fp, $string, strlen($string)); // will write the entire string to file without changing the '/n' // into a single byte for newline on Unix-like machines or CR/LF on Win32 machines </pre> Hope this helps explain the definition of "could be Binary Safe". This is the reason why you must specify the length! --Doug http://www.php.net/manual/en/function.fputs.php

« previous php.notes (#65568) next »