Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with fprintf ?

Problem with fprintf ?

Scheduled Pinned Locked Moved C / C++ / MFC
testingbeta-testinghelpquestion
9 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iltallman
    wrote on last edited by
    #1

    Anyone know of a problem with the old fprintf function? I have been using it for years now and all of a sudden during some testing it has started to crash inside the call.

    N P L 3 Replies Last reply
    0
    • I iltallman

      Anyone know of a problem with the old fprintf function? I have been using it for years now and all of a sudden during some testing it has started to crash inside the call.

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      iltallman wrote: I have been using it for years now and all of a sudden during some testing it has started to crash inside the call. Could you be trying to reference a memory location that no longer exists? -Nick Parker

      I 1 Reply Last reply
      0
      • N Nick Parker

        iltallman wrote: I have been using it for years now and all of a sudden during some testing it has started to crash inside the call. Could you be trying to reference a memory location that no longer exists? -Nick Parker

        I Offline
        I Offline
        iltallman
        wrote on last edited by
        #3

        No. I looked in the debugger at all the data and attributes - it all looked good with appropriate NULL ending strings

        P 1 Reply Last reply
        0
        • I iltallman

          Anyone know of a problem with the old fprintf function? I have been using it for years now and all of a sudden during some testing it has started to crash inside the call.

          P Offline
          P Offline
          Peter Weyzen
          wrote on last edited by
          #4

          I had a case once, where I did something like this. char *str = GetSomeInputString(); fprintf( F, str ); worked pretty well, but would crash once in awhile when someone put a %s. changed it to: fprintf( F, "%s", str ); all is well. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)

          R 1 Reply Last reply
          0
          • P Peter Weyzen

            I had a case once, where I did something like this. char *str = GetSomeInputString(); fprintf( F, str ); worked pretty well, but would crash once in awhile when someone put a %s. changed it to: fprintf( F, "%s", str ); all is well. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)

            R Offline
            R Offline
            Robert Little
            wrote on last edited by
            #5

            fprintf has always worked well for me. Except when I did something boneheaded like you point out. Sometimes I have done things like int i = 8675309; char *str = GetSomeString() fprintf(F, "%s", i, str);

            D P 2 Replies Last reply
            0
            • R Robert Little

              fprintf has always worked well for me. Except when I did something boneheaded like you point out. Sometimes I have done things like int i = 8675309; char *str = GetSomeString() fprintf(F, "%s", i, str);

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Robert Little wrote: int i = 8675309; Reminds me of a song!!

              1 Reply Last reply
              0
              • R Robert Little

                fprintf has always worked well for me. Except when I did something boneheaded like you point out. Sometimes I have done things like int i = 8675309; char *str = GetSomeString() fprintf(F, "%s", i, str);

                P Offline
                P Offline
                Peter Weyzen
                wrote on last edited by
                #7

                I've done that too. None of us are exempted from bonehead mistakes..... I've certainly had my share, and unfortunately they seem to be the most difficult to track down... It's my guess that the writer of this question made some boneheaded mistake.... Have fun! P.S. I don't really consider fprintf to be old.... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)

                1 Reply Last reply
                0
                • I iltallman

                  No. I looked in the debugger at all the data and attributes - it all looked good with appropriate NULL ending strings

                  P Offline
                  P Offline
                  Peter Weyzen
                  wrote on last edited by
                  #8

                  well -- fprintf works fine for me when I don't do something boneheaded. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)

                  1 Reply Last reply
                  0
                  • I iltallman

                    Anyone know of a problem with the old fprintf function? I have been using it for years now and all of a sudden during some testing it has started to crash inside the call.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    A common problem with formatting is that the parameters don't match the formatting string, and VC++ doesn't do a check to see if they match. Elaine :rose: The tigress is here :-D

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups