|
Perhaps this article[^] can give you an explanation.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I always get y_num=0 when y_num=65536
How to get rid of this problem (variable type,...)
Please help.
#include<br />
#include<br />
#include<br />
#include<br />
#include<br />
<br />
typedef unsigned int WORD;<br />
typedef WORD* WORDPTR;<br />
<br />
WORDPTR *S;<br />
WORDPTR D;<br />
<br />
WORD x_num;<br />
WORD y_num;<br />
<br />
WORD a;<br />
WORD b;<br />
WORD i, j;<br />
int main()<br />
{<br />
puts("------------------ Start --------------------");<br />
puts("");<br />
<br />
a = 0;<br />
printf("Enter a = ");<br />
scanf("%u", &a);<br />
<br />
<br />
b = 0;<br />
printf("Enter b = ");<br />
scanf("%u", &b);<br />
<br />
x_num = 1 << a;<br />
y_num = 1 << b;<br />
<br />
S = (WORDPTR *)malloc(x_num*sizeof(WORDPTR));<br />
if (S == NULL)<br />
{<br />
puts("Error 1!");<br />
return 1;<br />
}<br />
for (i = 0; i < x_num; i++)<br />
{<br />
S[i] = (WORDPTR)malloc(y_num*sizeof(WORD));<br />
if (S[i] == NULL)<br />
{<br />
puts("Error 2!");<br />
return 1;<br />
}<br />
}<br />
<br />
D = (WORDPTR)malloc(y_num*sizeof(WORD));<br />
if (D == NULL)<br />
{<br />
puts("Error 3!");<br />
return 1;<br />
}<br />
puts("OK!");<br />
<br />
return (0);<br />
}
-- modified at 4:15 Wednesday 14th November, 2007
|
|
|
|
|
ndtoan13 wrote: I know 1 << 256 == 2^256 = 65536
2^16 == 65536
1 << 16 == 65536
|
|
|
|
|
ndtoan13 wrote: I know 1 << 256 == 2^256 = 65536
The above is not true, in fact:
1 << 256 = 2^256 = <big>HUGE number ( ~ 10^77 ) </big>
even an hypothetical 256-bit wide integer cannot hold this number.
So I suggest to revise you convinctions (BTW 65536 = 2^16 ).
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.
|
|
|
|
|
Sorry I am wrong. 65536 = 2^16
I need to print an array[256x65536]
Thanks.
|
|
|
|
|
I know 1 << 256 = 2^256 = HUGE number ( ~ 10^77 )
It is my wrong type after 18h coding.
I want a code to print an array [256x65536]
--> x_num=256 and y_num=65536
Event I assign static value like y_num=65536, y_num still = 0
What type of this variable need to solve this problem?
Please help.
|
|
|
|
|
You need a 32-bit wide integer. Usually int it is enough, however it is system-dependent, you can check the wideness of your datatype using the sizeof operator, you need:
sizeof(you_integer_datatype) >= 4
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.
|
|
|
|
|
I checked size of my datatype WORD: sizeof(WORD)=2
It is system-dependent! -> Which system can do that?
OR if it can be set, how to set it to 32bit
Thanks
|
|
|
|
|
I mean, What is your system (e.g. PC with Windows XP, and so on...)?
Anyway try to change
typedef unsigned int WORD;
into
typedef unsigned long WORD;
and check again the size.
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.
|
|
|
|
|
Thanks a lot for your help.
By default, I use TC++ to build this porgram. It fails
I try it with VC++6, it works now.
I tried typedef unsigned int WORD; on TC++, It does not work.
|
|
|
|
|
Hi can any one tell me how to create a Modal dialog box in CWinThread derived class
Here i can able to create an dialog box but it is acting as an Modeless dialogbox.
VimalKumar.T
|
|
|
|
|
Is this CWinThread a UI thread?
If not, you probably should post a message to one of your windows -- asking it to open the dialog. ???
Just a thought -- someone else will have an actual answer.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
vethathiri wrote: Here i can able to create an dialog box but it is acting as an Modeless dialogbox.
Just want to know how do you verify that it is acting as Modeless Dialog box, is debugger goes to next line after DoModal() call ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I can able to work on the background "mean's i can operate menu items in modal dialog box it cannot be operated"
|
|
|
|
|
I can able to work on the background "mean's i can operate menu items. in modal dialog box it cannot be operated"
|
|
|
|
|
If the thread that creates the modal dialog is a different thread than the
thread another window (the main window, for example) was created on,
then of course it's going to behave like a modeless dialog - you have two
threads!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Typically, if I make a window in a separate thread, I do not give it the 'parent' of a window from a different thread. Some of the focus and input looping of a dialog gets mixed up if you do this. If you make a modeless dialog from a separate thread, better to give it the desktop as its parent. Then it and your main window can operate completely independantly of each other. If the modeless is created from same thread as parent, then by all means give it that parent.
|
|
|
|
|
Hi can any one tell me how to create a Modal dialog box in CWinThread derived class
Here i can able to create an dialog box but it is acting as an Modeless dialogbox.
|
|
|
|
|
how to change the color of caption text for a checkbox?
|
|
|
|
|
|
Can i use WM_CTLCOLOR in oninitdialog function. I want to set the color of caption text of a checkbox before displaying dialog in VC++.
|
|
|
|
|
I think is the best place to use it.
In the constructor you may have error/assertion because the window is not already created so you dont have any possibility to access visual controls, m_hWnd will be NULL and give you problems.
But in OnInitDialog all the objects are already created and it is called the very first time the dialog and its components are shown in the screen.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
subramanyeswari wrote: Can i use WM_CTLCOLOR in oninitdialog function. I want to set the color of caption text of a checkbox before displaying dialog in VC++.
you have to regularly handle teh OnCtlColor message for coloring the check box, and have to use SetTextColor there!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I am using wxWidgets for the first time in vs2005. I have included the necessary directories but I am facing an error->
error C3861: 'wxStrdupW': identifier not found
in buffer.h. I can find the declaration of 'wxStrdupW' in wxchar.h and this header file is already included in buffer.h. But still I am getting this error. Can anyone help me with this
S.Yamini
|
|
|
|
|
What kind of libraries do you link against?
Is there a UNICODE version to link against?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|