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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. cout behavior........

cout behavior........

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 5 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    I have a simple function: void Cell::SetNumber () { cout << "enter"; number= 1; cout << "exit" ; } I get a segment fault after the "enter" prints, and it never seems to leave the routine.number is just an int. What should I suspect? thanks, ns

    RaviBeeR M R 3 Replies Last reply
    0
    • N ns

      I have a simple function: void Cell::SetNumber () { cout << "enter"; number= 1; cout << "exit" ; } I get a segment fault after the "enter" prints, and it never seems to leave the routine.number is just an int. What should I suspect? thanks, ns

      RaviBeeR Offline
      RaviBeeR Offline
      RaviBee
      wrote on last edited by
      #2

      R u mixing printf and cout? /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

      N 1 Reply Last reply
      0
      • RaviBeeR RaviBee

        R u mixing printf and cout? /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

        N Offline
        N Offline
        ns
        wrote on last edited by
        #3

        nope. Just using cout.....

        1 Reply Last reply
        0
        • N ns

          I have a simple function: void Cell::SetNumber () { cout << "enter"; number= 1; cout << "exit" ; } I get a segment fault after the "enter" prints, and it never seems to leave the routine.number is just an int. What should I suspect? thanks, ns

          M Offline
          M Offline
          Maximilien
          wrote on last edited by
          #4

          is it possible that the Cell object is not valid ? or the "number" object ?


          Maximilien Lincourt Your Head A Splode - Strong Bad

          N 1 Reply Last reply
          0
          • N ns

            I have a simple function: void Cell::SetNumber () { cout << "enter"; number= 1; cout << "exit" ; } I get a segment fault after the "enter" prints, and it never seems to leave the routine.number is just an int. What should I suspect? thanks, ns

            R Offline
            R Offline
            Robert A T Kaldy
            wrote on last edited by
            #5

            How is number declared? Could you show more code? Robert-Antonio "Life is very hard, when you apply E-R model to it."

            1 Reply Last reply
            0
            • M Maximilien

              is it possible that the Cell object is not valid ? or the "number" object ?


              Maximilien Lincourt Your Head A Splode - Strong Bad

              N Offline
              N Offline
              nss
              wrote on last edited by
              #6

              This is the hundredth time I have made this same mistake.....I say MyClass * ptr, and then blithely do a ptr->method() on it, without having allocated memory which I think is what the problem is here. Many thanks. ns

              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