By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,723 Members | 1,876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,723 IT Pros & Developers. It's quick & easy.

fprintf problem

P: n/a
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.

Suggestions?

Feb 13 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 13 Feb, 22:13, grim...@blackbelts.co.uk wrote:
fprintf($Handle, 'A2);
Should be fprintf($Handle, 'A2');

That's just a typo not the problem!

Feb 13 '07 #2

P: n/a
gr*****@blackbelts.co.uk wrote:
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.

Suggestions?
'A2' isn't a format string?
Feb 13 '07 #3

P: n/a
Paul Lautman wrote:
gr*****@blackbelts.co.uk wrote:
>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.

Suggestions?

'A2' isn't a format string?

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>
Feb 14 '07 #4

P: n/a
On 14 Feb, 03:29, Curtis <zer0d...@verizon.netwrote:
Paul Lautman wrote:
grim...@blackbelts.co.uk wrote:
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.
Suggestions?
'A2' isn't a format string?

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>- Hide quoted text -

- Show quoted text -
It gives an run time error because none of the statements below it are
executed.

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

Rob

Feb 19 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.