Newbie question about linefeeds
Posted: Mon Oct 04, 2004 4:23 pm
Hello everybody I just registered to the forums! Woah! This place is huge, I think it'll be my new home
I would like some help with the line feed and carriage return characters. What I'm trying to do is output some text files to create an application error log. I didn't even start trying to append lines to the log when I realized I couldn't manage to write new lines.. This is the generic test code I wrote:
What I get in the file is one long line containing the information outputed to the file separated by "\n"s.. Is this supposed to happen? Or there's some configuration to my system that I should take care of? Obsiously I tried various combination to match systems compatibility (Mac \r Win \n\r) and I keep getting the same results, instead of the special chars I get printed to the file the literal \n..
It's very unclear to me at which level the system should translate those into what I mean to be a carriage return or a new line, if not both.
I develop over a Gentoo box with php4 and apache 2.
Thanks in advance for your inputs guys,
stay cool!
Burn
I would like some help with the line feed and carriage return characters. What I'm trying to do is output some text files to create an application error log. I didn't even start trying to append lines to the log when I realized I couldn't manage to write new lines.. This is the generic test code I wrote:
Code: Select all
$content = $db_day.$db_month.substr($db_year, 2, 2).'\n';
$content .= $dbf_day.$dbf_month.substr($dbf_year, 2, 2).'\n';
$content .= $priorita .'\n';
$content .= $record['titolo'].'\n';
$content .= $record['testo'].'\n';
$handle = fopen($filename, 'w'));
fwrite($handle, $content);
fclose($handle);It's very unclear to me at which level the system should translate those into what I mean to be a carriage return or a new line, if not both.
I develop over a Gentoo box with php4 and apache 2.
Thanks in advance for your inputs guys,
stay cool!
Burn