|
You mean behavioral design patterns? If yes, then Visitor is a behavioral design pattern only.
|
|
|
|
|
Here[^] is a good sample ...
|
|
|
|
|
Thanks for that link. Definitely it will be of some use for me.
|
|
|
|
|
That example uses GUI's own graphics context. And I am using OpenGL. So, it won't work with OpenGL.
Thanks anyways
|
|
|
|
|
why the output of program come as 65486, 65486??
Can anyone explain ????
int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr, &arr);
return 0;
}
|
|
|
|
|
|
Pointer name will give the base address of the array. Hence arr( pointer name ) and &arr both will point to the same address.
|
|
|
|
|
i have create Docking Dialog with CDialog
CDialogBar m_wndDlgBar;
in preCreateWindow
if (!m_wndDlgBar.Create(this, IDD_COMMAND_WINDOW,
WS_CHILD | WS_VISIBLE | CBRS_BOTTOM|CBRS_TOOLTIPS|CBRS_GRIPPER |CBRS_FLYBY| CBRS_SIZE_DYNAMIC, IDD_COMMAND_WINDOW))
{
TRACE0("Failed to create DlgBar\n");
return -1; }
m_wndDlgBar.EnableDocking (CBRS_ALIGN_BOTTOM );
EnableDocking(CBRS_ALIGN_BOTTOM );
DockControlBar(&m_wndDlgBar);
it Work fine. it display dialog with no error. but it does not give any event.
i have create Class ClsCommandWindow for IDD_COMMAND_WINDOW. in IDD_CCOMMAND_WINDOW i put 2 EditBox and one Button, one of Edit Box apply from Class CMyEdit because i have to use onChar Event.
now the DialogBar display dialog from it ID(IDD_CCOMMAND_WINDOW). with no use of Class. because it is not using class any event from that dialog box does not work.
When i TRACE ("%i\n",nChar); on OnChar it just did nothing.
please some one help me on this how to get event form that dialog box.
Thanks
Amrit
|
|
|
|
|
You need to subclass the dialog so that it can get events.
Sunil
|
|
|
|
|
Compound types, by definition, are types that are derived from other basic types. Right?
In my opinion, pointers, with their unique representation( * and &), must be classificated as a fundamental type.
Am I wrong?
|
|
|
|
|
sawerr wrote: Compound types, by definition
Interestingly, Bjarne Stroustrup does not provide a definition in his glossary of C++[^].
|
|
|
|
|
A pointer is not a type.
Otherwise you would be able to create it this way - * p;
|
|
|
|
|
Since a pointer is a memory address its type if you lie is actually its size, and hence is the same as the bit ness of the OS, 32 or 64, 4 or 8.
However, and this is where it gets interesting, when you increment a pointer the address increases by the size of the declared type. So a char pointer goes up by one byte, a DWORD pointer by 4 and so on.
|
|
|
|
|
Hi,
In my client server application, am sending array of data in ASCII format, while receiving it on other end, i cant able to retrieve whole data using dynamic array.
Instead i used static array and i received the whole data.Can anyone help me to receive the same data using dynamic array.
|
|
|
|
|
without seeing the code that you are using in your receiver it is difficult to guess how to improve it.
|
|
|
|
|
Declare dynamic char buffer:
char* Dynamic_Recieve_Buffer = new char[2000];
Use dynamic buffer:
recv(mySocket , Dynamic_Receive_Buffer , 2000 , 0);
Example code:
#include<stdio.h>
#include<winsock2.h>
#pragma comment(lib,"ws2_32.lib") //Winsock Library
int main(int argc , char *argv[])
{
char* Dynamic_Receive_Buffer = new char[2000];
WSADATA wsa;
SOCKET mySocket;
struct sockaddr_in server;
int recv_size;
char *message;
printf("\nInitialising Winsock...");
if (WSAStartup(MAKEWORD(2,2),&wsa) != 0)
{
printf("Failed. Error Code : %d",WSAGetLastError());
return 1;
}
printf("Initialised.\n");
if((mySocket = socket(AF_INET , SOCK_STREAM , 0 )) == INVALID_SOCKET)
{
printf("Could not create socket : %d" , WSAGetLastError());
}
printf("Socket created.\n");
server.sin_addr.s_addr = inet_addr("74.125.235.20");
server.sin_family = AF_INET;
server.sin_port = htons( 80 );
if (connect(mySocket , (struct sockaddr *)&server , sizeof(server)) < 0)
{
puts("connect error");
return 1;
}
puts("Connected");
message = "GET / HTTP/1.1\r\n\r\n";
if( send(mySocket , message , strlen(message) , 0) < 0)
{
puts("Send failed");
return 1;
}
puts("Data Send\n");
if((recv_size = recv(mySocket , Dynamic_Receive_Buffer , 2000 , 0)) == SOCKET_ERROR)
{
puts("recv failed");
}
puts("Reply received\n");
Dynamic_Receive_Buffer[recv_size] = '\0';
puts(Dynamic_Receive_Buffer);
return 0;
}
|
|
|
|
|
Can I find size of datatype without using sizeof operator ????
|
|
|
|
|
Not that I am aware of. What problem are you trying to solve?
|
|
|
|
|
How about this:
#define NO_SIZEOF_SIZEOF(type) ((long)(((type *)0) + 1))
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Thanks, didn't think of that.
|
|
|
|
|
Even "youngsters" can have a few tricks up their sleeves.
I also wonder why the OP would need such a thing...maybe he's working with some stripped-down version of C for some egzotic platform that doesn't have sizeof...or it's a school-assignment-type question...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Psst!
It's spelled "exotic."
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
what a perfect way!
|
|
|
|
|
Thanks
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
sizeof operator is the right way. I cannot see the reason for avoiding it.
Veni, vidi, vici.
|
|
|
|