SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Dec 1, 2004, 06:02 #1
- Join Date
- May 2002
- Location
- Oslo
- Posts
- 138
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Problem with lineshifts, "\n", in text file!
I've a small piece of code which writes a few lines of text to file:
$content .= "Order id: ".$this->order['orders_id']."\n";
$content .= "Total price: ".$this->order['value']."\n";
$content .= "Date Purchased: ".$this->order['date_purchased']."\n";
Then $content is written to file using fwrite().
This works fine, but when I open the file in notepad the text is not displayed line by line, but as a single continuous string. How can I make it appear line by line in notepad?
This is necessary because a colleague of mine are using Visual Basic to read the file. And he tells me VB can only read files line by line, so his script won't work when there's only one line.
-
Dec 1, 2004, 06:45 #2
- Join Date
- Mar 2004
- Posts
- 1,647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
\n or nl2br r html formated.....
-
Dec 1, 2004, 06:48 #3
- Join Date
- May 2002
- Location
- Oslo
- Posts
- 138
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by reminder
-
Dec 1, 2004, 08:33 #4
- Join Date
- Mar 2004
- Posts
- 1,647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
that was the point
-
Dec 2, 2004, 17:49 #5
- Join Date
- May 2002
- Posts
- 3
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
\n - new line, ASCII 10 (Dec) / 0D (Hex)
\r - carriage return, ASCII 13 (Dec) / 0A (Hex)
\n - Unix line ending
\r\n - Windows line ending
\r - Mac line ending
Bookmarks