|
Cedric Moonen wrote: Is your string always "agsdfgggggg" and you always need to remove "gggggg" ? In which case, I don't see why you are asking the question
Have you ever tried to use agsdf when it was next to gggggg? It's difficult at best.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
What about
CString name = "agsdfgggggg";
int l = name.GetLength();
int count=0;
while (l-- > 0)
{
if ( name[l] != 'g') break;
count++;
}
if ( count > 0 )
{
name = name.Left(name.GetLength() - count);
}
?
[added]
Sorry for the poor answer, I didn't realize that correct one is LIQUID NITROGEN.
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Let me restate your requirement.
You want the repeating character at the end to be removed.
If this requirement is correct, here is what you can do.
name = name.TrimRight(name[name.GetLength() - 1]);
Of course, you will need error checking, which I have omitted.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
If I have two HKEY handles how could I compare them?
How could I get the full registry tree path of an open HKEY?
I could not find between the Reg... functions any one
which could help me to solve above two problems.
|
|
|
|
|
I assume you want to read the registry keys and compare them. There's tons of articles on how to read values from the registry.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
no this is simple one and there are tone of articles.
What I want is to get what is behind the HKEY in therms of
path in the registyr tree.
For example If I open two HKEY to
HKEY_CLASSES_ROOT\*
How could I get from the HKEY handle this path:
HKEY_CLASSES_ROOT\*
And how could I compare the two HKEY handles to check
that they both are point to same path in the registry tree.
|
|
|
|
|
I think what Christian said is correct - you have to read the data (enumerate the keys and/or values) that each of your HKEY's point to to see if the paths etc are the same (ie by comparing the results of the enumeration) - since you dont 'know' where you are in the tree and likely cant make any assumptions, I think this is the safest bet ..
'g'
|
|
|
|
|
But with this proposal if there are two keys with same names/values
I should consider that both HKEY are the same.
This is very recursive solution which could take time to compare
each name/value of the sub keys.
Any other ideas?
|
|
|
|
|
> How could I get the full registry tree path of an open HKEY?
With Kernel apis.
|
|
|
|
|
Hi All,
How do test dll which is created in C.
I have created dll using .NET FRAMEWORK in C programming.I want to test my dll as well as Unit testing.How do i do that.Please gimme any idea...
Thanks,
Mohan.T
Mohan t
|
|
|
|
|
You need to create a test program that will use your dll...
|
|
|
|
|
mohant$.net wrote: I have created dll using .NET FRAMEWORK in C programming.
Interesting: how did you fit the C language inside the .NET framework?
mohant$.net wrote: I want to test my dll as well as Unit testing.How do i do that.Please gimme any idea...
You should build an application that uses the library, possibly stressing it a lot.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Tuesday, September 8, 2009 3:33 AM
|
|
|
|
|
Did you use .NET IDE for develop native dll?
Thanks and Regards,
Selvam,
http://www.wincpp.com
|
|
|
|
|
Yes........
Mohan t working for N.I.C
|
|
|
|
|
|
Hi All
Can i get double length?I have a variable double l=111.98987744,so can i get
l length
Plz help me.
|
|
|
|
|
You mean the size in bytes of a double ?
If yes, use the sizeof operator:
int lenght = sizeof(double);
|
|
|
|
|
Thanks for reply.
i use your code.It's return always 8.
double tr=111.989877445678;
int lenght = sizeof(tr);
result is length=8;
|
|
|
|
|
Yes, that's the size of a double.
Errr.. wait, you make me wonder. Are you asking for the lenght of the string representing the double ? If yes, there's no way to know that with precision because of the floating point precision. For instance, if you store 1 in a double, its value won't be exactly 1, but maybe 1.00000000001. So, it's not what you expect.
Anyway, why do you want know something like that ? It doesn't make a lot of sense... If you want to convert your double to a string, you can always specify the precision you want to keep.
|
|
|
|
|
you can always specify the precision you want to keep
yes i am converting double to Cstring(CSting str.formate("%.4f",double)).
But i want to convert same values like if double tr=98.29982355 then i want to convert Cstring str=98.29982355 and when tr=9.89 then str=9.89.
So i think if i have a length of double then it's make to easy.
Any way there is any more option to convert double to CString.
Plz help me
|
|
|
|
|
Davitor wrote: But i want to convert same values like if double tr=98.29982355 then i want to convert Cstring str=98.29982355 and when tr=9.89 then str=9.89.
So i think if i have a length of double then it's make to easy.
Well, but that's what I was explaining: tr=98.29982355, in that specific case, it is very probable that your double will be stored with some imprecision (for instance tr=98.299823499999999). There's no way for the computer to guess which precision you want to keep, that's up to you to tell to the computer where the number should be rounded when converting to string. I suggest you read this article[^] about floating point precision.
|
|
|
|
|
Why don't you use str.Format("%f", d) then?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello everybody,
what happend if i give codes in between #if 0 and #endif, will these line executed or not?
Thanks & Regards,
A. Gopinath.
|
|
|
|