Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Debugging / July 2003

Tip: Looking for answers? Try searching our database.

Conditional Breakpoint not hit! - Need some help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bvvarma - 23 Jul 2003 08:55 GMT
Hello,

I have a simple console application in C++ whose main() does the
following...

char* s = "Hello";
printf("String is %s\n",s);
return 0;

I set a conditoinal breakpoint on the line with the printf, the condition is
s == "Hello".
The breakpoint is not hit and execution continues without stopping at the
breakpoint.
How can i make this happen? Is there something wrong with the condition i
give?
Incidentally when the condition involves an int variable the break point is
hit! Can we not use strings as conditions?

I'm using VS.Net 7.0.9466

Thanks in advance
Vivek
Mike Forkey [MSFT] - 30 Jul 2003 18:41 GMT
--------------------
| From: "bvvarma" <bvvarma@hotmail.com>
| Subject: Conditional Breakpoint not hit! - Need some help
[quoted text clipped - 23 lines]
| Thanks in advance
| Vivek

Correct, you can't use strings the way you are doing it. The equality
operator is not going to work on a string (especially not a char *.) What
you'd need to be able to do is use strcmp() in the BP condition. But
unfortunately, it won't work. This is something we hope to fix in a future
version.

In the meantime, what you need to do to work around this is to test the
value of each character inthe condition:
s[0] == 'H' && s[1] == 'e' && s[2] ==  'l' && s[3] == 'l' && s[4]== 'o'
It isn't pretty but it does work.

Mike Forkey
Visual C++ Team
Legal stuff: This posting is provided "AS IS" with no warranties, and
confers no rights. You assume all risk for your use.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.