Re: line breaks

From: Date: Tue, 25 Nov 2003 15:38:44 +0000
Subject: Re: line breaks
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-170895@lists.php.net to get a copy of this message
Rodney Green wrote: <snip>
Actually, I'm not having problems with that. The whitespace is still there in between the commands and arguments, etc. I'm using fgets , not fread. Not sure what the difference between the two is but I'll check it out. The problem I am having however is that at the end of the shell script that is created it puts an additional line. It writes the chown command line for all of the users then puts the following line with no user specified. chown :html /var/spool/mail/ The other lines show up as: chown rgreen:html /var/spool/mail/rgreen chown rgreen01:html /var/spool/mail/rgreen01 chown rod:html /var/spool/mail/rod Any ideas where that extra line is coming from? thanks again, Rod
Is there a carriage return (new line) after the last entry in your text file? You can add an if test in there to stop this... $buffer = rtrim ( $handle[$i] ); if ( $buffer != "" ) {
    fwrite ($fhandle, "chown $buffer:html /scripts/var/spool/mail/$buffer\n", 4096);
} -- By-Tor.com It's all about the Rush http://www.by-tor.com

« previous php.general (#170895) next »