|
Shah Satish wrote: if(x1.compareNocase(s1 || s2)
{
do something
}
if ((x1.CompareNoCase(s1)== 0) || (x1.CompareNoCase(s2)== 0))
{
}
Shah Satish wrote: as in || is right or wrong??
Here it is wrong, using your way.
|
|
|
|
|
I have code..
If(Loopname.CompareNocase(x1)==0 || Loopname.CompareNocase(mytext->contents)==0).
but its not working..
|
|
|
|
|
Shah Satish wrote: but its not working..
Means what ?
Can you try modifying it to,
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))
{
}
|
|
|
|
|
No..Not modified..This is my actual code..But i dont know its not working.
|
|
|
|
|
ie only one case is wroking properly..Both together is not working..
If( (Loopname.CompareNocase(x1)==0)---This is working
(Loopname.CompareNocase(mytext->contents)==0))--This is working
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))--But together is not working..
|
|
|
|
|
you are using a logical OR operator, which returns TRUE if one of the 2 operands is TRUE. so if its 1st part (1st comparison) is TRUE, then the 2nd one is not executed...
are you sure you want to use a OR ? don't you need a AND ( && ) instead ?
|
|
|
|
|
Ya..I have to use only "or" function..
but among them one is pointer and one is string..
mytext->contents is a pointer..
as in
AcDbMtext *mytext ;
mytext->Contents;
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))
x1 is cstring and (mytext->contents)is a pointer..
what to do?? How t compare it?
|
|
|
|
|
Loopname is a CString, right ?
then look at the signature of CString::CompareNoCase(). it gets a PCXSTR parameter (so, pointer to char).
so ther's no problem in doing so.
if your code doesn't work, it is because of what i notified you previously. have you tried inverting the two statements in the OR operation (C-style string compared first) ?
|
|
|
|
|
Shah Satish wrote: But together is not working..
What does this mean ?
Remember, Loopname.CompareNocase(mytext->contents) will not be called if Loopname.CompareNocase(x1) returns 0. (or rule)
|
|
|
|
|
mytext->contents is a pointer..
as in
AcDbMtext *mytext ;
mytext->Contents;
what to do?? How t compare it?
|
|
|
|
|
you didn't read the answers
|
|
|
|
|
What you've shown in now way indicates that contents is a pointer. While mytext is indeed a pointer, you've shown nothing of its contents member. If contents is indeed a pointer, what's it a pointer to?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ya..I have to use only "or" function..
but among them one is pointer and one is string..
mytext->contents is a pointer..
as in
AcDbMtext *mytext ;
mytext->Contents;
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))
x1 is cstring and (mytext->contents)is a pointer..
what to do?? How t compare it?
|
|
|
|
|
Come on Satish !
You are still not reading answers well and replying to our queries well.
1. What does not working mean ? You need to be very clear.
2. Have you taken in to consideration when using || operator second operand will be looked only when first is false ?
Shah Satish wrote: x1 is cstring and (mytext->contents)is a pointer..
It should not matter here.
|
|
|
|
|
Hi Prasad !!!
I am sorry for delay..The ocde is exactly right n its working now..The problem was in my software...But now its working properly..
Thanks man !!!
Shah
|
|
|
|
|
if this does not work, split the CompareNoCase and the if in different statements and debug each statement separatly.
bool b1 = (x1.CompareNoCase(s1)== 0);
bool b2 = (x1.CompareNoCase(s2)== 0);
if ( b1 || b2 )
{
}
|
|
|
|
|
Hi Maximilien !!!
I am sorry for delay..The Code is exactly right n its working now..The problem was in my software...But now its working properly..
Thanks man !!!
Shah
|
|
|
|
|
When I create a child frame and close it, a memory leak is reported in the output window as follows:
"childfrm.cpp(44) : {2414101} client block at 0x01AF7A00, subtype c0, 444 bytes long."
I would like to know what is possibility for this leak.
I am initializing only one bool variable in the constructor of child frame class.
I am having some user-defined functions in child frame class with return type LRESULT,
and a CSplitterWnd object which is used to create panes with CreateStatic() and CreateView() methods.
Is there any chance for leak from CSplitterWnd.
Is there function to delete the panes created by the splitter.
Any help would be greatly appreciated.
Thanks & Regards,
Suman
|
|
|
|
|
What's on this line: childfrm.cpp(44)
|
|
|
|
|
It is IMPLEMENT_DYNCREATE(CChildFrm ,CMDIChildWnd).
But I found that this leak happens only when the program stops with some error and selecting "Stop Debugging". The leak is not happening incase of normal halt.
Thanks & Regards,
Suman
|
|
|
|
|
rp_suman wrote: But I found that this leak happens only when the program stops with some error and selecting "Stop Debugging". The leak is not happening incase of normal halt.
That's normal behavior. CFrameWnd-derived windows delete themselves when they are destroyed.
If you stop the application before the window is destroyed (by it's parent in this case) then
it will show as a leak.
|
|
|
|
|
rp_suman wrote: the program stops with some error and selecting "Stop Debugging".
In this case, normal clean up routines does not get called . As Mark said, its normal behaviour.
|
|
|
|
|
Thank you very much to all you people for great help.
Thanks & Regards,
Suman
|
|
|
|
|
dear all ;
please i need to know how can i deal with the ps2 with the vc++ and so i can open the port and take the data .
thanx alot
ahmad al-omar
|
|
|
|
|
Hi
How should I pass the CArray object to a function and access those elements in the function.
Thanks in advance.
Taruni
|
|
|
|