CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 29th, 2005, 11:07 AM
    Nina Donath Nina Donath is offline
    Junior Member
     
    Join Date: Aug 2001
    Location: Alabama
    Posts: 10
    Nina Donath is an unknown quantity at this point (<10)
    Assignment to structure value does not work

    I have a C++ .NET project.

    In a .h file I use for global #defines and definitions, I have the following:

    typedef struct _mini
    {
    int iVal;
    } miniStruct;

    typedef struct _test
    {
    miniStruct mini[10];
    } testStruct;



    At the beginning of the Form Load function :

    testStruct teststr;

    teststr.mini[0].iVal = 11;
    teststr.mini[1].iVal = 22;

    Can someone tell me why the 2nd array value (i.e. teststr.mini[1].iVal) does not get assigned to 22? It is always 0. It is driving me crazy.

    Thanks for any insight you can give,

    nina
    Reply With Quote
      #2    
    Old August 2nd, 2005, 12:43 PM
    Nina Donath Nina Donath is offline
    Junior Member
     
    Join Date: Aug 2001
    Location: Alabama
    Posts: 10
    Nina Donath is an unknown quantity at this point (<10)
    Re: Assignment to structure value does not work

    No one in this forum posted a reply about this problem I was having, but I now have a solution, which I will share mostly to save someone else from 3 days of anxiety.

    I ended up posting this problem to another users group and someone said, if you convert teststr.mini[1].iVal to a string and display it in a message box, it shows the value of 22, so what was the problem?

    Well, he was right. I then explained that going through the debugger - Quickwatch or the cursor placed over teststr.mini[1].iVal always displayed 0. Why?

    Explanation: A bug in the Microsoft debugger! ARGGG The following link explains it:


    http://www.dotnet247.com/247referenc...44/222866.aspx

    ned.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 02:26 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009