![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
CString changing an independant int
{ This is probably a non-environment-specific problem buried in an
environment-specific context; thus accepted. -mod } L.S. For a couple of days I've been trying to write a small Windows program, and although C is no problem I'm struggling witch C++ (VS2008). Somehow I must be doing something wrong. I've got this dialog class in which I've defined some ints and CStrings, and some functions. What happens is this: in one of those functions I assign a value to one of these CStrings (just strFoo = "bar";). At that exact moment in the program the value of one of the class's ints changes too. In C I'd know my string buffer was too small or something, but I thought it would be impossible with a CString... Probably a dumb question, but any answer is appreciated. Thanks, Rob -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |
|
|||
|
Re: CString changing an independant int
Rob Prins wrote:
> { This is probably a non-environment-specific problem buried in an > environment-specific context; thus accepted. -mod } > > L.S. > > For a couple of days I've been trying to write a small Windows program, > and although C is no problem I'm struggling witch C++ (VS2008). Somehow > I must be doing something wrong. > > I've got this dialog class in which I've defined some ints and CStrings, > and some functions. What happens is this: in one of those functions I > assign a value to one of these CStrings (just strFoo = "bar";). At that > exact moment in the program the value of one of the class's ints changes > too. In C I'd know my string buffer was too small or something, but I > thought it would be impossible with a CString... > How do you know this? Is the debugger showing it? Have you done a print of the int variable, to confirm it's not just an artifact of a debugger. And as the mod noted, CString is MFC specific. You really should try to learn the Standard library (std::string). -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |
|
|||
|
Re: CString changing an independant int
On Aug 1, 5:04 am, Rob Prins <robpr...@xs4all.nl> wrote:
> > I've got this dialog class in which I've defined some ints and CStrings, > and some functions. What happens is this: in one of those functions I > assign a value to one of these CStrings (just strFoo = "bar";). At that > exact moment in the program the value of one of the class's ints changes > too. In C I'd know my string buffer was too small or something, but I > thought it would be impossible with a CString... > > Probably a dumb question, but any answer is appreciated. Care to post some minimal example? Most probably you are doing something wrong elsewhere... -- Regards, Alex -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|