Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

watching a particular value

Status
Not open for further replies.

carpeliam

Programmer
Mar 17, 2000
990
US
I want to find out when any particular string has a certain value.. there probably isn't a way to do this, but I might as well ask.

is there a way I can stop the process as soon as any variable has a certain value? I'm trying to find out which string has a certain value (and when)... Liam Morley
lmorley@wpi.edu
"light the deep, and bring silence to the world.
light the world, and bring depth to the silence."
 
#include<string>
#include<iostream>
using namespace std;
int main()
{
string x;
x=&quot;xxxxx&quot;;
x+=&quot;yyyyy&quot;
if(x==&quot;xxxxxyyyyy&quot;)cout<<&quot;xxxxxyyyyy&quot;<<endl;
else cout<<&quot;error&quot;<<endl;
return 0;
} John Fill
1c.bmp


ivfmd@mail.md
 
I don't think I was clear. Say I have 100 strings in 15 different classes and any one of them can contain a certain value. I want to find out as soon as that value is assigned <i>any</i> of them at any time, and I want to stop execution with a breakpoint of sorts. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
If you are using a string class, such as MFC's CString, you might be able to do this by setting a breakpoint in one or more of the class's functions and then assigning conditions to the breakpoint(s).

For instance, I set a breakpoint in CString::AssignCopy. Then I went to Edit...Breakpoints. I clicked the Condition button and entered the following expression:

lpszSrcData[0]=='A' && lpszSrcData[1]=='B'

That causes the debugger to stop where I set the break point only if the first two characters of the string are &quot;AB&quot;.

Note that setting breakpoints like this can drastically slow execution of your program in the debugger.

For more info, see
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top