|
Hi guys,
I hope I do not have overlooked something small in my code, or you probably will make fun of me:
I have a function that determines if a critical error has occured in really old code which just returns a list of structs containing error information. Someone already added a std::string containing the error-message to these structs, and I can simply get that one.
I need to ignore a certain error message (which virtually always occurs), so I wrote the following code:
<br />
std::string noRecords = "no records found";
for (int i = curr.numberOfElements(); i > 0; --i) <br />
{<br />
if (std::string::npos != curr.currentElement.info.find_first_of(noRecords))<br />
{<br />
return true;<br />
}<br />
curr.setToPreviousElement();<br />
}<br />
return false;<br />
<br />
which is supposed to return true ("a real error occured") if there is any other error than "no records found" and false otherwise (i.e. "just noRecords errors").
As mentioned before, I cannot change the implementation of the errorList. Just ignore the naming, please, as I had to "obfuscate" a little.
Well, the result: obviously "no records found" is a part of "unexpected end of file". Thats what currElement.info (the std::string) contains.
I also tried the following comparisons:
curr.currentElement.info.find_first_of(noRecords) < 0
curr.currentElement.info.find_first_of("no records found") < 0
curr.currentElement.info.find_first_of("no records found") != std::string::npos
but to no avail. I tried over 100 info strings with the above function, it never got inside the conditional.
I HOPE that this is really simple (that means, I messed up somewhere). find_first_of actually IS the string::find_first_of(), I double-checked that.
GNAH.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
-- modified at 11:25 Tuesday 24th January, 2006
|
|
|
|
|
First of all, this is the wrong approach. You should fix the bug, not hide it.
find_first_of will find the first char in your string which is one of the chars in the string you passed in. I think you want string::find.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
First of all, I know, but there is nothing I can do about it.
And, BUMMER, I totally misunderstood the MSDN. Another problem if you're not a native speaker and just "taking a glance" at the docs.
Of course, find() is what I have to use.
Thank you very much, Christian.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I understand that the equivalent for __gc in VC++ 2005 is ref keyword. Similarly can anyone update me on the equivalent for __gc* in VC++ 2005.
Thanks in advance
Thanks and Regards
Madhu
|
|
|
|
|
|
Thanks for the intimation. I have also posted the message in VC++/CLI forum
Thanks and Regards
Madhu
|
|
|
|
|
toxcct wrote: i'm sure Mr sivakumar will be a good help over there...
LOL - seeing as he's one of only three people worldwide using this stuff ? :P
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
And me as of the last couple of days, so that makes four
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hello,
I created with Visual C++ 2003 - a Beta 2 Version - an dialog based application. I inserted a menu in the Resourccen view.
In VC6 I clicked onto the Dialog, said in proberties dialog "IDR_MENU1". That's all. But here in VC NET how can I connect these both (dialog & menu) ? Because if I run the App I don't see anything.
Thank You for help!
|
|
|
|
|
|
Hello,
I use Vc NET 2003. The way you described is the way by using VC6.0. I already know it. But in VC NET there is no Property of the dialog where I set to the menu ID...
|
|
|
|
|
sure there is one, but it simply have not the same look... it is a docked tabed window, in which the proterties are exposed as an array...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Yes, right, there is the property window with 6 small buttons and a combobox. In the combobox I select the IDD_MyDlG (Dialog). The 6 small button with names "kategory", "alphabet", "properties", "Messages", "Control-Events", "PropertiesSites"
Only the button "Messages" is enabled, the others are not enabled. If I click the button "Messages" I see a list of:
"WM_ACTIVATE"
"..."
"..."
That's all. I think because of the BETA VERSION of VC NET the game is over here for me?
|
|
|
|
|
|
Yes I did. Which other properties did you mean? The list of the "Messages" is very long:
"WM_ACTIVATE"
...
...
...
"WN_WINDOWSPOSCHANGING"
"WM_INICHANGE"
|
|
|
|
|
the windows messages are not what you must look for...
open the dialog box in design editor, then select the dialog, right-click on it, choose Properties, then you should have a property called Menu...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Yes, I did it. But nothing with "menu". I think the Beta Version doesn't have it!
Or this is the bug, therefor it is a BETA.
|
|
|
|
|
Thank you for help!
I think I 'll better go back to DevC++ go on console
To much bugs in this IDE! It's just aborted...
|
|
|
|
|
can't you get a release version of the IDE ?
it's been 3 years that is released, and now, Visual Studio 2005 is released too !!!
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
|
Hello,
the Version is Visual Studio.Net 7.0.9254 (Beta 2). I got it in 2003.
What do you mean with "you could always add the meny at runtime (in OnInitDialog())... "?
-- modified at 15:42 Tuesday 24th January, 2006
Oh, sorry you are right because of the old release. I wanted to try this old release (3 CDs), because I already have it here, cannot download the trial 2005 (too big) from the internet. I should reinstall it now
|
|
|
|
|
toxcct wrote: meny
Menu;P. Back to primary.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
I need someone to solve this bug for me: I can't get the password from this piece of code. I am getting the username fine but the prog can't seem to get the password and display it or compare it.
AnsiString a=AnsiString(DataModule1->DatabaseProjectTracking->Params->Values["Password"]).c_str();
DataModule1->DatabaseProjectTracking->LoginPrompt=false;
ShowMessage(DataModule1->DatabaseProjectTracking->Params->Values["User Name"]);
ShowMessage(a);
if(a=="flx")
{
ShowMessage("Ok");
}
if(a!="flx")
{
ShowMessage("Not Ok");
}
Many Thanks,
Priya
|
|
|
|
|
Hi Guys ,
I hav posted this earlier too but did't get any solution .
I hav to instal my VC++ application on MS Server 2003 , I copied all the dlls manually (with help of Depends Tool), but my application did't ran. Then after searching from every where I just installed MS Visual C++ 6. on that machine and it solved my problem . Now uninstalling MS Visual C++ again cause my application not to run.
I get a RunTime error without any details. I think problem is that I have to register some dlls or need to copy some dll that DEPENDS Tool is not showing !
Any suggestions of Tips plzzzzzzzzzzzzzzz !
Regards,
ZINC
|
|
|
|