On Fri, Dec 13, 2002 at 12:44:14AM -0600, Jami wrote: > > I know that fwrite needs to be written as such: > > $Open=fopen($MyFile, "w"); > fwrite($Open, "Text to add to file.\n"); > > The file is being saved on a Unix server, but Windows/Mac users will be downloading >the file. How can I create line breaks that notepad/textpad will use to create new >lines, instead of boxes where the break should be? I have tried changing "w" to "wb" >as suggested on php.net, but that does not work either and I am out of ideas.
For Windows, use: fwrite($Open, "Text to add to file.\r\n"); And for Mac, I think it's: fwrite($Open, "Text to add to file.\r"); Aren't standards wonderful? ;-) If you want a more general solution, you might play with something like: $text="This is the first line.\nAnother line makes two.\n"; if ($target=="win") $text=str_replace( "\n", "\r\n", $text); else if ($target=="mac") $text=str_replace( "\n", "\r", $text); fwrite($Open, $text); Set your $target somewhere (maybe by parsing HTTP_USER_AGENT), and you can stick with consistent use of UNIX-style text in your PHP. There's probably a more elegant way to do this, but I don't know it. -- Paul Chvostek <[EMAIL PROTECTED]> Operations / Abuse / Whatever +1 416 598-0000 it.canada - hosting and development http://www.it.ca/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php