CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Threaded View

  1. #1
    Join Date
    Dec 2011
    Posts
    44

    Strange CString behaviour??

    Hello,

    I have the following code segments:


    Code:
    CString fooA = TEXT("");
    CString fooB = TEXT("");
    and then I have a class member/method like this:

    Code:
    CString* pStr; // this is a pointer to my CString;
    
    void Constructor(CString* str){ // Constructor of my class
        this->pStr = str;
    }
    
    void doSomething(){ //Member method of my class
       *(this->pStr) = TEXT("FOO");
    }

    When I pass '&fooA' to the constructor of my class and execute 'doSomething' somewhen, the content of 'fooB' changes? How can this be? Every variable in my whole program which has TEXT("") assigned to it changes it's content to "FOO" - did I change TEXT("")'s content??? please help


    kind regards,
    Michael
    Last edited by chaos2oo2; March 2nd, 2012 at 07:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured