Re: [PHP] Writing text files in Windows 2k

2003-02-10 Thread Chris Hayes


I need to write some data to a text file but when I use

 $this-ao_file_handle = fopen($this-ao_file_name,ab);
$str_txt.= \n;
 fwrite($this-ao_file_handle,$str_txt);

It does not display the new line. I saw somwhere that for DOS files you need
to use ASCII LF and CR. Which I did. It still does not display the new line.


LF CR = \r\n
What did you view the file with?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Writing text files in Windows 2k

2003-02-10 Thread Adam Voigt




Precisely where did you get the b in your second parameter to fopen?

I didn't see it on the fopen manual page at:



http://www.php.net/fopen



If you just want to write to the file and not read it, try changing the second

parameter to just w.



On Mon, 2003-02-10 at 03:34, Joe Njeru wrote:

Hi All,



I need to write some data to a text file but when I use



 $this-ao_file_handle = fopen($this-ao_file_name,ab);

$str_txt.= \n;

 fwrite($this-ao_file_handle,$str_txt);



It does not display the new line. I saw somwhere that for DOS files you need

to use ASCII LF and CR. Which I did. It still does not display the new line.



Thanks in advance

Joe Njeru







-- 

PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP] Writing text files in Windows 2k

2003-02-10 Thread Adam Voigt




Doh, doh, doh!

Just saw b was allowed for binary on the fopen page. Never mind.



On Mon, 2003-02-10 at 09:13, Adam Voigt wrote:

Precisely where did you get the b in your second parameter to fopen? 

I didn't see it on the fopen manual page at: 



http://www.php.net/fopen



If you just want to write to the file and not read it, try changing the second 

parameter to just w. 



On Mon, 2003-02-10 at 03:34, Joe Njeru wrote: 

Hi All,



I need to write some data to a text file but when I use



$this-ao_file_handle = fopen($this-ao_file_name,ab);

$str_txt.= \n;

fwrite($this-ao_file_handle,$str_txt);



It does not display the new line. I saw somwhere that for DOS files you need

to use ASCII LF and CR. Which I did. It still does not display the new line.



Thanks in advance

Joe Njeru







-- 

PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP] Writing text files in Windows 2k

2003-02-10 Thread Ford, Mike [LSS]
-Original Message-
From: Adam Voigt [mailto:[EMAIL PROTECTED]]
Sent: 10 February 2003 14:13


Precisely where did you get the b in your second parameter to fopen? 
I didn't see it on the fopen manual page at: 

http://www.php.net/fopen http://www.php.net/fopen   

 
Er -- quoting from that very page:
 
 
Note: The mode may contain the letter 'b'. This is useful only on systems
which differentiate between binary and text files (i.e. Windows. It's
useless on Unix). If not needed, this will be ignored. You are encouraged to
include the 'b' flag in order to make your scripts more portable
 
 
Cheers! 

Mike 

- 
Mike Ford,  Electronic Information Services Adviser, 
Learning Support Services, Learning  Information Services, 
JG125, James Graham Building, Leeds Metropolitan University, 
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom 
Email: [EMAIL PROTECTED] 
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Writing text files in Windows 2k

2003-02-10 Thread Chris Hewitt
Joe Njeru wrote:


Hi All

The following is the text file generated. I'm runing on Windows 2k spack 3,
When I open it in Excell it gives me the data but not seperated into lines.
Do you have any suggestions.



It does for me in Excle 97 SP2, but I suspect there should be more lines 
than there are (I get 13 lines). Some lines look as though they should 
be split up. Assuming each line should begin with a date, then they are 
not on separate lines because there is no end-of-line there.

HTH
Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Writing text files in Windows 2k

2003-02-10 Thread Adam Voigt




Yes, I'm aware of that, if you would have read my reply 10 seconds after I sent

the first one, I corrected myself.



On Mon, 2003-02-10 at 09:25, Ford, Mike [LSS] wrote:

-Original Message-

From: Adam Voigt [mailto:[EMAIL PROTECTED]]

Sent: 10 February 2003 14:13





Precisely where did you get the b in your second parameter to fopen? 

I didn't see it on the fopen manual page at: 



http://www.php.net/fopen http://www.php.net/fopen   



 

Er -- quoting from that very page:

 



Note: The mode may contain the letter 'b'. This is useful only on systems

which differentiate between binary and text files (i.e. Windows. It's

useless on Unix). If not needed, this will be ignored. You are encouraged to

include the 'b' flag in order to make your scripts more portable

 



Cheers! 



Mike 



- 

Mike Ford,  Electronic Information Services Adviser, 

Learning Support Services, Learning  Information Services, 

JG125, James Graham Building, Leeds Metropolitan University, 

Beckett Park, LEEDS,  LS6 3QS,  United Kingdom 

Email: [EMAIL PROTECTED] 

Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part