Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Help with fwrite command (https://www.warriorforum.com/programming/186348-help-fwrite-command.html)

bodyboard662 5th March 2010 12:52 AM

Help with fwrite command
 
Hi,

I am trying to use a PHP file to write another PHP file. I've got most of my code working, but I can seem to write the characters "/n". Every time I do, the PHP file just skips to the next line. I have tried printing "/" and the "n" with two separate fwrite commands, but this still does not work. How do I get around this problem?

Thanks,

Dan Liptak 5th March 2010 01:32 AM

Re: Help with fwrite command
 
Does \\n work?

Later,
Dan

TrafficMystic 5th March 2010 03:06 AM

Re: Help with fwrite command
 
It looks like your using the wrong end of line character, as dan says try --> \n in place of /n

TheWorker 5th March 2010 07:26 AM

Re: Help with fwrite command
 
As you have found, the \n has a special meaning (new line).

To get around this try:-
1) Escape the slash '\' by using a double slash '\\', i.e. \\n (as said by Dan above)
or
2) Enclose the string in single quotes rather than double quotes.

PS: I'm assuming here that in your post that you meant \ instead of /

lisag 5th March 2010 11:28 AM

Re: Help with fwrite command
 
fwrite and newline?


All times are GMT -6. The time now is 06:28 PM.