fprintf problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • grimrob@blackbelts.co.uk

    fprintf problem

    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?

  • grimrob@blackbelts.co.uk

    #2
    Re: fprintf problem

    On 13 Feb, 22:13, grim...@blackbe lts.co.uk wrote:
    fprintf($Handle , 'A2);
    Should be fprintf($Handle , 'A2');

    That's just a typo not the problem!

    Comment

    • Paul Lautman

      #3
      Re: fprintf problem

      grimrob@blackbe lts.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?


      Comment

      • Curtis

        #4
        Re: fprintf problem

        Paul Lautman wrote:
        grimrob@blackbe lts.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($Handl e, '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>

        Comment

        • grimrob@blackbelts.co.uk

          #5
          Re: fprintf problem

          On 14 Feb, 03:29, Curtis <zer0d...@veriz on.netwrote:
          Paul Lautman wrote:
          grim...@blackbe lts.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

          Comment

          Working...