|
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.
|
|
|
|
|
Those code will not be compiled. So will never appear in the executable you build.
|
|
|
|
|
Such code is removed by the preprocessor, hence the compiler won't see it and the chances it will be ever executed looks very little...
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 us say i have a number of printf commands and strings in my code
eg printf("Hi"),printf("Hello") and other strings
Are all these strings stored in a string table automatically?
|
|
|
|
|
No. Those strings are not stored in the string table. I guess such strings are stored in the .rdata section of the binary where as the string table and its strings are stored in the .rsrc section of the binary file.
|
|
|
|
|
This (almost) exact same question was posted yesterday.
http://www.codeproject.com/Messages/3187912/Strings-in-EXE.aspx[^]
And I've a vague memory of it beign posted a couple of days before.
Are you both in the same class? Bidding for the same project!
I find it a little spooky...
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Iain Clarke, Warrior Programmer wrote: Are you both in the same class?
Either that or he created 2 accounts in order to increase the penetration of this forum.
|
|
|
|
|
Nope. They weren't yesterday and probably they aren't today.
If you wish to know where are them, then use an editor able to show binary files content (in a meaningful way) as, for instance, Notepad++ with the Hex Editor plugin.
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]
|
|
|
|
|
|
Hi all,
I am trying to handle keyboard strokes. For handling ctrl+c i have written this piece of code in my PreTranslateMsg function
BOOL CKeyboardStroke::PreTranslateMessage(MSG* pMsg)
{
switch(pMsg->message)
{
case WM_KEYDOWN:
{
if(GetKeyState(VK_CONTROL) && (pMsg->wParam == 0x43))
{
CTest obj;
obj.DoModal();
}
if(GetKeyState(VK_CONTROL) && (pMsg->wParam == 0x56))
{
AfxMessageBox(_T("ctrl V"));
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
But my problem is when i press ctrl+c dialog box is opened and when i close it my application crashes.
Can anybody help me in this.
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
DoModal blocks the application at that point. It's not wise to block the application inside PreTranslateMsg. Try showing the dialog box in OnKeyDown handler or may be try this
if(GetKeyState(VK_CONTROL) && (pMsg->wParam == 0x43))
{
CTest obj;
obj.DoModal();
return TRUE;
}
|
|
|
|
|
thanku it worked
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi,
I am trying to automate the setting of text for a spincontrol through
a c++ program. The spinControl is in a different application.
The scenario is as follows:
There is an application which pops up a dialog box
which contains a Spincontrol. I want to set the text of
the spincontrol.
Input available: The Dialog box name and the control specifier of
the spincontrol.
Please colud someone help me.
Thanks in advance for any help.
|
|
|
|
|
If you are using same application, you can access the object.
The spinControl is in a different application.
But, if you are using different application, you can use RPC mechanism for update values.
http://msdn.microsoft.com/en-us/library/aa511491.aspx[^]
Thanks and Regards,
Selvam,
http://www.wincpp.com
|
|
|
|
|
Thanks for the reply..
I am writing a c++ program to automatically set the value of a spin control..
I have used UDM_SETPOS message in the SendMessage.
It is not able to set the value that i try to pass..
Any help will do.
|
|
|
|
|
From SetWindowPos documentation,
hWndInsertAfter
[in] Handle to the window that precedes the positioned window in the Z order.
I have a doubt. the window that 'precedes' the position window is on top of it or below it?
My understanding is that hWndInsertAfter is the window immediately on top of positioned window but I am feeling suspicious.
|
|
|
|