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. debugging VS6.0 C (not ++)... how to view entire array contents?

debugging VS6.0 C (not ++)... how to view entire array contents?

Scheduled Pinned Locked Moved C / C++ / MFC
c++debuggingquestiondata-structurestutorial
10 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.
  • J Offline
    J Offline
    Jesse Evans
    wrote on last edited by
    #1

    Folks, Using the Visual C++ 6.0 debugger, how can I view (or better, print to file) the contents of an array of doubles? I know I can see the address of the array variable and the contents of the first member element using the Quickwatch or watch window, but I need to examine the entire contents of the array (length ~300 elements). I can't use the TRACE macro because this app does not use MFC (and it's coded in 'C', not C++). I think I recall a notation style one could type into the QuickWatch window that would do this but I've forgotten it. TIA!

    'til next we type... HAVE FUN!! -- Jesse

    V D K Z M 5 Replies Last reply
    0
    • J Jesse Evans

      Folks, Using the Visual C++ 6.0 debugger, how can I view (or better, print to file) the contents of an array of doubles? I know I can see the address of the array variable and the contents of the first member element using the Quickwatch or watch window, but I need to examine the entire contents of the array (length ~300 elements). I can't use the TRACE macro because this app does not use MFC (and it's coded in 'C', not C++). I think I recall a notation style one could type into the QuickWatch window that would do this but I've forgotten it. TIA!

      'til next we type... HAVE FUN!! -- Jesse

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

      Just click the '+' sign next to the variable's name. You can also look at individual items using square brackets (e.g., MyArray[2], MyArray[4]).


      "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

      "Judge not by the eye but by the heart." - Native American Proverb

      J 1 Reply Last reply
      0
      • J Jesse Evans

        Folks, Using the Visual C++ 6.0 debugger, how can I view (or better, print to file) the contents of an array of doubles? I know I can see the address of the array variable and the contents of the first member element using the Quickwatch or watch window, but I need to examine the entire contents of the array (length ~300 elements). I can't use the TRACE macro because this app does not use MFC (and it's coded in 'C', not C++). I think I recall a notation style one could type into the QuickWatch window that would do this but I've forgotten it. TIA!

        'til next we type... HAVE FUN!! -- Jesse

        V Offline
        V Offline
        valikac
        wrote on last edited by
        #3

        another approach is operator [] extracted via local variable Kuphryn

        J 1 Reply Last reply
        0
        • J Jesse Evans

          Folks, Using the Visual C++ 6.0 debugger, how can I view (or better, print to file) the contents of an array of doubles? I know I can see the address of the array variable and the contents of the first member element using the Quickwatch or watch window, but I need to examine the entire contents of the array (length ~300 elements). I can't use the TRACE macro because this app does not use MFC (and it's coded in 'C', not C++). I think I recall a notation style one could type into the QuickWatch window that would do this but I've forgotten it. TIA!

          'til next we type... HAVE FUN!! -- Jesse

          K Offline
          K Offline
          krmed
          wrote on last edited by
          #4

          I'm assuming that your array is allocated with "new", otherwise simply clicking on the + button would expand your entire array. If that's the case: double *pMyDouble = new double[300]; then in your watch you can simply use pMyDouble,300 That will show 300 elements of type double. Hope that helps.

          Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

          J 1 Reply Last reply
          0
          • J Jesse Evans

            Folks, Using the Visual C++ 6.0 debugger, how can I view (or better, print to file) the contents of an array of doubles? I know I can see the address of the array variable and the contents of the first member element using the Quickwatch or watch window, but I need to examine the entire contents of the array (length ~300 elements). I can't use the TRACE macro because this app does not use MFC (and it's coded in 'C', not C++). I think I recall a notation style one could type into the QuickWatch window that would do this but I've forgotten it. TIA!

            'til next we type... HAVE FUN!! -- Jesse

            Z Offline
            Z Offline
            Zac Howland
            wrote on last edited by
            #5

            You should be able to use either the [] operator or write it as *(myVar + index) -- where myVar is the array and index is the number of the element you want to view. If you need/want to see the entire array, you might want to open a file and have its output saved to it at various points in time.

            If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

            J 1 Reply Last reply
            0
            • D David Crow

              Just click the '+' sign next to the variable's name. You can also look at individual items using square brackets (e.g., MyArray[2], MyArray[4]).


              "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

              "Judge not by the eye but by the heart." - Native American Proverb

              J Offline
              J Offline
              Jesse Evans
              wrote on last edited by
              #6

              Thanks, but I need to see the contents of the entire array at once. Clicking the + only shows the first element because the array variable is really a pointer allocated dynamically.

              'til next we type... HAVE FUN!! -- Jesse

              1 Reply Last reply
              0
              • V valikac

                another approach is operator [] extracted via local variable Kuphryn

                J Offline
                J Offline
                Jesse Evans
                wrote on last edited by
                #7

                kuphryn wrote:

                operator []

                This application is straight 'C', not C++.

                'til next we type... HAVE FUN!! -- Jesse

                1 Reply Last reply
                0
                • K krmed

                  I'm assuming that your array is allocated with "new", otherwise simply clicking on the + button would expand your entire array. If that's the case: double *pMyDouble = new double[300]; then in your watch you can simply use pMyDouble,300 That will show 300 elements of type double. Hope that helps.

                  Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

                  J Offline
                  J Offline
                  Jesse Evans
                  wrote on last edited by
                  #8

                  krmed wrote:

                  pMyDouble,300

                  Aha! You've won yourself a cupie doll! That's the Watch Window notation I had forgotten. Thanks a bunch!

                  'til next we type... HAVE FUN!! -- Jesse

                  1 Reply Last reply
                  0
                  • Z Zac Howland

                    You should be able to use either the [] operator or write it as *(myVar + index) -- where myVar is the array and index is the number of the element you want to view. If you need/want to see the entire array, you might want to open a file and have its output saved to it at various points in time.

                    If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                    J Offline
                    J Offline
                    Jesse Evans
                    wrote on last edited by
                    #9

                    Zac Howland wrote:

                    use either the [] operator or write it as *(myVar + index)

                    and

                    Zac Howland wrote:

                    want to see the entire array, you might want to open a file

                    I need the entire array at once, preferably in a file, but I'd like to get it without adding more code to the app. Another CP user mentioned the myArray,300 notation which display the first 300 members of an array. That should work if I can find a way to capture that to a file.

                    'til next we type... HAVE FUN!! -- Jesse

                    1 Reply Last reply
                    0
                    • J Jesse Evans

                      Folks, Using the Visual C++ 6.0 debugger, how can I view (or better, print to file) the contents of an array of doubles? I know I can see the address of the array variable and the contents of the first member element using the Quickwatch or watch window, but I need to examine the entire contents of the array (length ~300 elements). I can't use the TRACE macro because this app does not use MFC (and it's coded in 'C', not C++). I think I recall a notation style one could type into the QuickWatch window that would do this but I've forgotten it. TIA!

                      'til next we type... HAVE FUN!! -- Jesse

                      M Offline
                      M Offline
                      Michael Dunn
                      wrote on last edited by
                      #10

                      You can enter the address of the start of the array in the memory window, then cycle through the display formats with Alt+F11 until you come to the right one (there are 14 views - just try them until you see double values ;))

                      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                      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