fprintf problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
fprintf just is not working. I am using PHP Version 4.3.9. Whatever I
do fprintf just fails.

For example:

fwrite($Handle, 'A1');
fprintf($Handle, 'A2);

The first line always works, the second always fails. Likewise any
other example.


Re: fprintf problem

On 13 Feb, 22:13, grim...@blackbelts.co.uk wrote:

Quoted text here. Click to load it

Should be fprintf($Handle, 'A2');

That's just a typo not the problem!

Re: fprintf problem

grimrob@blackbelts.co.uk wrote:
Quoted text here. Click to load it

'A2' isn't a format string?  

Re: fprintf problem

Paul Lautman wrote:
Quoted text here. Click to load it

No, that's not the issue, but unless he needs to use printed  
formatting, there's no real reason to use fprintf over fwrite.

@Original Poster: how does fprintf fail, do you get an error, or is  
the input not written how you expected? You need to give details, or  
no one can help you.

In the meantime, try reading the manual: <http://php.net/fprintf

Re: fprintf problem

Quoted text here. Click to load it

It gives an run time error because none of the statements below it are

I got round it by using sprintf (exactly the same apart from the
different first argument) into a string, and then fwrite.


Site Timeline