Jump to content


Photo

how do i make a line break in fwrite()


  • Please log in to reply
5 replies to this topic

#1 just-j

just-j
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts

Posted 24 July 2006 - 10:14 AM

i want to do somthing like this..

fwrite($fo, this is NEWLINE);
fwrite($fo, a test NEWLINE);

and make the out come "
this is
a test
"
and not "
this isa test
"


#2 designationlocutus

designationlocutus
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 24 July 2006 - 10:17 AM

Does \n work?

#3 just-j

just-j
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts

Posted 24 July 2006 - 10:28 AM

with fwrite($fo, $towrite \n);
i get Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\wamp5\www\tbbc\forum\write.php on line 25

Parse error: parse error, unexpected T_STRING in C:\wamp5\www\tbbc\forum\write.php on line 25

#4 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 24 July 2006 - 10:31 AM

Try fwrite($fo, $towrite . "\n");
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#5 just-j

just-j
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts

Posted 24 July 2006 - 11:56 AM

i did the fwrite($fo, $towrite . "\n");  and it dosent break to a new line in the .txt file..  it just adds this little block every where the \n is and keeps the text on the same line.  if i echo the .txt with php, then php recognises those blocks as line breaks  but that does me no good for what im tring to accomplish. 

#6 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 24 July 2006 - 12:22 PM

Then try a carriage return character too: "\r\n".
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users