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. Why my "i" counter doesn't increases?

Why my "i" counter doesn't increases?

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingquestion
11 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.
  • R Rassul Yunussov

    The cycle i made should work for three times, for the first time in the debug the "i" counter increses from zero to 1, as i see on the second time "i" counter doesn't increases!!! But it have to! I can't understand... Here is the code: for(int i =0;i<ColumnsNumber;i++) { //Reading Column Definition DBFColumn column; dbffile.read(column.FieldName,10); dbffile.read((char*)&column.caPad,sizeof(char)); dbffile.read((char*)&column.cFieldType,sizeof(char)); dbffile.read((char*)&column.lwhere,sizeof(int)); dbffile.read((char*)&column.cFieldLength,sizeof(char)); dbffile.read((char*)&column.cFieldPrecision,sizeof(char)); dbffile.read((char*)&column.caPad3,14); /*for(int j= 0;j -- modified at 2:57 Wednesday 15th February, 2006

    R Offline
    R Offline
    Rage
    wrote on last edited by
    #2

    How much is ColumnsNumber ? ~RaGE();

    R 1 Reply Last reply
    0
    • R Rassul Yunussov

      The cycle i made should work for three times, for the first time in the debug the "i" counter increses from zero to 1, as i see on the second time "i" counter doesn't increases!!! But it have to! I can't understand... Here is the code: for(int i =0;i<ColumnsNumber;i++) { //Reading Column Definition DBFColumn column; dbffile.read(column.FieldName,10); dbffile.read((char*)&column.caPad,sizeof(char)); dbffile.read((char*)&column.cFieldType,sizeof(char)); dbffile.read((char*)&column.lwhere,sizeof(int)); dbffile.read((char*)&column.cFieldLength,sizeof(char)); dbffile.read((char*)&column.cFieldPrecision,sizeof(char)); dbffile.read((char*)&column.caPad3,14); /*for(int j= 0;j -- modified at 2:57 Wednesday 15th February, 2006

      O Offline
      O Offline
      Owner drawn
      wrote on last edited by
      #3

      Rassul Yunussov wrote:

      for(int i =0;i<ColumnsNumber;i++)

      what is the value of ColumnsNumber


      Owner drawn Jesus Loves

      M 1 Reply Last reply
      0
      • O Owner drawn

        Rassul Yunussov wrote:

        for(int i =0;i<ColumnsNumber;i++)

        what is the value of ColumnsNumber


        Owner drawn Jesus Loves

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

        Did you check you ColumnsNumber. I think it would be 1. -Malli...!

        R 1 Reply Last reply
        0
        • M Malli_S

          Did you check you ColumnsNumber. I think it would be 1. -Malli...!

          R Offline
          R Offline
          Rassul Yunussov
          wrote on last edited by
          #5

          The ComunsNuber is 3, but my cycle runs more than 3 times, because the "i" counter doesn't increases!!! I Can send you the solution in archive, give me you e-mail. And You'll see. The solution is on visual studio 2005 professional

          1 Reply Last reply
          0
          • R Rage

            How much is ColumnsNumber ? ~RaGE();

            R Offline
            R Offline
            Rassul Yunussov
            wrote on last edited by
            #6

            The ComunsNuber is 3, but my cycle runs more than 3 times, because the "i" counter doesn't increases!!! I Can send you the solution in archive, give me you e-mail. And You'll see. The solution is on visual studio 2005 professional

            R D 2 Replies Last reply
            0
            • R Rassul Yunussov

              The cycle i made should work for three times, for the first time in the debug the "i" counter increses from zero to 1, as i see on the second time "i" counter doesn't increases!!! But it have to! I can't understand... Here is the code: for(int i =0;i<ColumnsNumber;i++) { //Reading Column Definition DBFColumn column; dbffile.read(column.FieldName,10); dbffile.read((char*)&column.caPad,sizeof(char)); dbffile.read((char*)&column.cFieldType,sizeof(char)); dbffile.read((char*)&column.lwhere,sizeof(int)); dbffile.read((char*)&column.cFieldLength,sizeof(char)); dbffile.read((char*)&column.cFieldPrecision,sizeof(char)); dbffile.read((char*)&column.caPad3,14); /*for(int j= 0;j -- modified at 2:57 Wednesday 15th February, 2006

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #7

              I can't see anything in your code that would cause that problem. Are you sure the value of ColumnsNumber is what you expect? Also, check to make sure your sizes in the dbffile.read() calls are correct - you might be encountering a memory smashing bug.

              Ryan

              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

              1 Reply Last reply
              0
              • R Rassul Yunussov

                The cycle i made should work for three times, for the first time in the debug the "i" counter increses from zero to 1, as i see on the second time "i" counter doesn't increases!!! But it have to! I can't understand... Here is the code: for(int i =0;i<ColumnsNumber;i++) { //Reading Column Definition DBFColumn column; dbffile.read(column.FieldName,10); dbffile.read((char*)&column.caPad,sizeof(char)); dbffile.read((char*)&column.cFieldType,sizeof(char)); dbffile.read((char*)&column.lwhere,sizeof(int)); dbffile.read((char*)&column.cFieldLength,sizeof(char)); dbffile.read((char*)&column.cFieldPrecision,sizeof(char)); dbffile.read((char*)&column.caPad3,14); /*for(int j= 0;j -- modified at 2:57 Wednesday 15th February, 2006

                M Offline
                M Offline
                Malli_S
                wrote on last edited by
                #8

                You do one thing, replace the variable 'i' with something else. Because that might be clashing. -Malli...!

                1 Reply Last reply
                0
                • R Rassul Yunussov

                  The ComunsNuber is 3, but my cycle runs more than 3 times, because the "i" counter doesn't increases!!! I Can send you the solution in archive, give me you e-mail. And You'll see. The solution is on visual studio 2005 professional

                  R Offline
                  R Offline
                  Rage
                  wrote on last edited by
                  #9

                  is i declared somewhere else as global ? or do you have a scope clash ? Try and rename it. ~RaGE();

                  1 Reply Last reply
                  0
                  • R Rassul Yunussov

                    The ComunsNuber is 3, but my cycle runs more than 3 times, because the "i" counter doesn't increases!!! I Can send you the solution in archive, give me you e-mail. And You'll see. The solution is on visual studio 2005 professional

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

                    Rassul Yunussov wrote:

                    ...but my cycle runs more than 3 times...

                    How are you verifying this?


                    "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

                    R 1 Reply Last reply
                    0
                    • D David Crow

                      Rassul Yunussov wrote:

                      ...but my cycle runs more than 3 times...

                      How are you verifying this?


                      "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

                      R Offline
                      R Offline
                      Rassul Yunussov
                      wrote on last edited by
                      #11

                      well, shame on me. I found the problem... I was reading the data to the pointer, that i didn't reserved in the memory. So i erased the memory where "i" was stored.

                      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