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. Confused in abby

Confused in abby

Scheduled Pinned Locked Moved C / C++ / MFC
comgraphicsdebugginghelpquestion
4 Posts 3 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.
  • PJ ArendsP Offline
    PJ ArendsP Offline
    PJ Arends
    wrote on last edited by
    #1

    Dear Forum, Ok, this is really starting to bug me. Anybody have any idea why the 'TableName' is not being added to the string 'str', even though the 'TableName' seems to be valid as the watch window shows the correct value and the TRACE call does manage to successfully out put it?

    for (std::vector<DFields *>::iterator it = pConfig->Samples.begin(); it != pConfig->Samples.end(); ++it)
    {
    CString str = _T("");
    if (pConfig->IncludeComputer)
    {
    str += (*it)->ComputerName;
    str += _T(" : ");
    }
     
    if (pConfig->IncludeTable)
    {
    TRACE("*%s*\n", (*it)->TableName); // TableName successfully TRACEd
    str += (*it)->TableName; // Why TableName not added to string????
    str += _T(" : ");
    }
     
    str += (*it)->SampleName;
     
    m_ListSelected.AddString(str);
    }

    After this function, 'str' is (sans quotes): "Barn 1 Feed : : Total Daily Feed" and the TRACE output is: "*743 Daily*". str should be: "Barn 1 Feed : 743 Daily : Total Daily Feed" I have tried to do a rebuild all, exit dev studio and then rebuild all, even rebooted my computer. But still no luck. All I know is that I will probably see what I am doing wrong as soon as I hit the submit button:~ [edit] ComputerName, Tablename, and SampleName are all CStrings. [/edit] Signed Confused in abby


    [

    ](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!

    Within you lies the power for good; Use it!

    L 1 Reply Last reply
    0
    • PJ ArendsP PJ Arends

      Dear Forum, Ok, this is really starting to bug me. Anybody have any idea why the 'TableName' is not being added to the string 'str', even though the 'TableName' seems to be valid as the watch window shows the correct value and the TRACE call does manage to successfully out put it?

      for (std::vector<DFields *>::iterator it = pConfig->Samples.begin(); it != pConfig->Samples.end(); ++it)
      {
      CString str = _T("");
      if (pConfig->IncludeComputer)
      {
      str += (*it)->ComputerName;
      str += _T(" : ");
      }
       
      if (pConfig->IncludeTable)
      {
      TRACE("*%s*\n", (*it)->TableName); // TableName successfully TRACEd
      str += (*it)->TableName; // Why TableName not added to string????
      str += _T(" : ");
      }
       
      str += (*it)->SampleName;
       
      m_ListSelected.AddString(str);
      }

      After this function, 'str' is (sans quotes): "Barn 1 Feed : : Total Daily Feed" and the TRACE output is: "*743 Daily*". str should be: "Barn 1 Feed : 743 Daily : Total Daily Feed" I have tried to do a rebuild all, exit dev studio and then rebuild all, even rebooted my computer. But still no luck. All I know is that I will probably see what I am doing wrong as soon as I hit the submit button:~ [edit] ComputerName, Tablename, and SampleName are all CStrings. [/edit] Signed Confused in abby


      [

      ](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!

      L Offline
      L Offline
      Led 0
      wrote on last edited by
      #2

      I don't have a clue, but have you tried casting the TableName to f.e. (char *) or something alike..? I wouldn't be amazed if it was some sort of type-confusion..

      PJ ArendsP 1 Reply Last reply
      0
      • L Led 0

        I don't have a clue, but have you tried casting the TableName to f.e. (char *) or something alike..? I wouldn't be amazed if it was some sort of type-confusion..

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        hmmm. That worked. wierd:confused: Thanks a lot:-D.


        [

        ](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!

        Within you lies the power for good; Use it!

        N 1 Reply Last reply
        0
        • PJ ArendsP PJ Arends

          hmmm. That worked. wierd:confused: Thanks a lot:-D.


          [

          ](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!

          N Offline
          N Offline
          Neville Franks
          wrote on last edited by
          #4

          Its because your mixing crappy old MFC CString and lovely new STL, you naughty boy you.:-D Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

          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