HughbertD Posted March 5, 2008 Share Posted March 5, 2008 Hi all, I am writing some data to a file (well appending) I am using \n for a new line return, but all I get is a small square, and all the data is on one line $file="export_$time"; $handle=fopen($file,'a'); $data="$start2 TO $end2\n"; fwrite($handle, $data); fclose($handle); Thanks for any help you can give. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted March 5, 2008 Share Posted March 5, 2008 try \r\n Quote Link to comment Share on other sites More sharing options...
shocker-z Posted March 5, 2008 Share Posted March 5, 2008 If you open it in word or some rich text editor then save it, it will work. It's just the way notepad is. or a less im missing somthing on how to get past it... Give \n\r a try but im sure it does the same. Rgards Liam Quote Link to comment Share on other sites More sharing options...
HughbertD Posted March 5, 2008 Author Share Posted March 5, 2008 \r\n worked! Thanks! Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted March 5, 2008 Share Posted March 5, 2008 \r\n worked! Thanks! \n = windows systems \r = unix when you use both the version of OS you run ignores the other usually Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 5, 2008 Share Posted March 5, 2008 \r\n worked! Thanks! \n = windows systems \r = unix when you use both the version of OS you run ignores the other usually Are you sure? From what I have found through experience, *nix is \n while windows is \r\n Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted March 5, 2008 Share Posted March 5, 2008 its something like that I think you might be right, but unix ignores what windows likes and windows ignores what unix likes so you need a catch all to make em both happy usually Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 5, 2008 Share Posted March 5, 2008 Windows can accept either \r\n or \n as a new lines. It all depends on the application you use to view the generated file. Notepad prefers \r\n for newlines any other new line char and it'll display [] in replacement. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.