|
CDC::Rectangle(...) and CDC::DrawText(...)
Russell
|
|
|
|
|
Hi everybody,
i have a class which stores char arrays, for example char name[50];
If i write int test = sizeof(inst->name); test has the value 50, which his OK.
Now i like to send a the char array to a function, there'in it has the form char*
and i sizeof() of this char* returns only the size of the pointer or something like this.
How can i find the number of allocated chars from this char* ?
Big thanks !
|
|
|
|
|
baerten wrote: How can i find the number of allocated chars from this char*
you can use _msize() to find the size of buffer allocated in heap. I.e the function will work in the secnarios like
char *pszName = new char[50];<br />
fun( pszName );
but not for
char szName[50];<br />
fun( szName );
So to solve such pblms we usually pass the size of array also to such functions.
|
|
|
|
|
You should prefer strlen which will check the real size of your null-terminated string and not the size of the 'container'. So, if you copy "Hello" in your buffer, strlen will return 5 and not 50.
Is that what you are looking for ? If no, then you should maybe elaborate a little bit more.
|
|
|
|
|
short answer, you can't. When passing arrays around, it is always good practice to also send the number of items, or use one of the STL templates like std::vector
Waldermort
|
|
|
|
|
Have you not ever used functions that take a buffer and the size of that buffer as arguments?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
That's called "array decay" Just google for the term and you'll find the explanation.
|
|
|
|
|
one word (sorta)
std::string myfancystringclass;
|
|
|
|
|
I'm sorry, My english is not well.
I want to display line symbol of GIS in a dialog.My idea is to use listctrl control with owner draw property,I wrote some code , but the result of the program is poor,could anyone give me an idea or some code on how to do it?
|
|
|
|
|
yidingyu wrote: but the result of the program is poor
what you want to draw exactly?
Can some articles (here on CP) on list controls help you?
Russell
|
|
|
|
|
I think it is too difficult for me to explain, because my poor english.
Now,I want to show line symbols in a control(Maybe listctrl control or tree control)Such as Simple line symbol,Cartographic line symbol,Hash line symbol,I use a COM to draw this line,and want to show them in a control.
I try to use listctrl's virtual function drawitem to show these line ,but, I cann't finish the code, could you give me some examples ?
|
|
|
|
|
|
yidingyu wrote: ...but, I cann't finish the code...
Why not? What's the problem?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How would I go about making my application respond to DDE "opens with" functions. I mean when you select "Folder Options" in Explorer and view the action for a file type it has the option to use DDE. I would like to be able to respond to the DDE message for any verb and any file type, like a ShellExecuteHook (Which does not seem to respond to verbs which use DDE).
Could anyone point me in the right direction?
|
|
|
|
|
One way is to "register" your file's extension (i.e., add keys and values to the registry).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have to input a year so that it will show the month and day of Easter of that year. Professor provided these to calculate it.
[edit]
Than just below, he said: Use individual functions to calculate each of the values
I don't get what he means by that. I can easily use the calculations as an assignment statement, but as a function? Am I understanding him correctly?
-- modified at 5:03 Wednesday 26th September, 2007
|
|
|
|
|
imagine what the forum would become if every of your classmates were asking for help about this homework...
|
|
|
|
|
They are in the class or different classes?;)
|
|
|
|
|
I guess:
int GetEasterDay(int Year){/*Do compute*/}
int GetEasterMonth(int Year){/*Do compute*/}
He wants that you make some homeworks. I think thats really OK
Please read an beginner book about programming like "C++ for Dummies". This give you an overview.
Greetings from Germany
|
|
|
|
|
|
What are you doing taking a class (presume it's programming) when you can even be bothered using google or buying a book and learning a few things yourself ?
How can you not know what a function is ? ANY basic book/webpage will tell you this.
|
|
|
|
|
MoboTech wrote: ...it will show the month and day of Easter of that year.
Since Easter occurs at some point between late March and late April each year, and it follows the cycle of the moon, how are you calculating this? Of course, tables up to 2020 (and possibly beyond) do exist.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The problem is i hooked opengl glDrawElements and i want to read before hooking the opengl with detours the real memory.
Dunno havent found anything yet could anyone post a example how would look it. And i want read the 32 first bytes on the original opengl ok thnx.
|
|
|
|
|
What are you trying to do exactly ? I have absolutely no idea of what you mean by 'original bytes'... Could you elaborate a bit ?
|
|
|
|
|
I hooked opengl and i want before the hooking function to spoof/patch the memory coz detours leave a leave a 0xE9 op trace. But i have no idea how to call the original memory i quess something with readprocessmemory but here aint a tutorial ok.
|
|
|
|