I'm always a bit suspicious about forms of array initialization, so I automatically assumed that was what you're at.
Sure, the code is missing a const there, which makes me wonder if it has been compiled as C-code, rather than C++? But I wonder if it's even possible to compile the invocation of a socket object as C-code - I don't think it is...
In fact it should not, as it would require the compiler to analyze the semantics of the code in order to make sure that the variableSTRLEN is not being changed. Even though this could be done in an easy example like this, the syntax is just as wrong as a missed ';'. Have you ever seen a compiler insert a missing ';' for you, no matter how obvious the fix?
I'm not that familiar with the ClientSocket class but I have a few observations / questions.
1) Clearly you expect "recMessage" to be a null terminated string (you "cout" it)
2) Who puts the NULL character at the end of each message?
3) Your buffer is "STRLEN" characters long (assuming you fix the declaration), you tell RecvData to read "STRLEN" characters. Who accounts for the NULL? Either the buffer needs to be one character bigger or the RecvData should be for one character smaller.
4) there is nothing to indicate the length of the received message in that API so how do you know or verified that all messages are < 200 characters as you stated in another reply.
5) the memset at the end of the routine does nothing useful. While it looks OK, are you sure that statement is not causing the problem.
6) other folks have commented on the declaration "char recMessage[STRLEN]" where STRLEN is not a #define constant but a variable. I suspect this is not what is used in the actual compiled code.
Regarding 3) and the code you linked, you need to pass STRLEN-1 to the sub. RecvData takes a size (STRLEN in this case), passes it directly to recv() which returns in the variable i the amount of bytes read. Then buffer[i] is set to '\0'. Which means that in the second worst case you write size, so the 0-termination writes to index STRLEN, which means the buffer should be STRLEN+1 in size at least. In the worst case scenario, SOCKET_ERROR is returned from receive and you'll end up trying to write to buffer[-1]. So... please tell me that the code at the site is not what you are using... please.
I am having a project which is for 32 bit platform.
I am adding 64 bit support also.
32 bit compilation is able to open & read registry while 64 bit compilation is not able to open registry.
I was opening HKEY_CLASSES_ROOT. I guess it might be related to permissions but I could not figure it out.
Even worse 64 bit compilation is not able to load swf while 32 compilation does it successfully.
Any guess why?
32 bit compilation works in both 32 bit & 64 bit. But I need a separate 64 bit edition so I am trying to do that. 64 bit runs but not able to open registry and swf. 64 bit compilation does not run on 32 bit
Could you debug through the 64 bit compilation and specifically post the return values from the registry functions, like RegCreateKeyEx (or RegOpenKeyEx) and also what the RegQueryValueEx function returns, and any other you are using in the particular piece of code that does not work.
It'd also help if you post your code. Without more information, we're flying blind here
I am confused with Imagelist_LoadBitmap. It certainly makes sense if we create an imagelist from ICON file(resource), because icon file can have multiple images.
But within Bitmap file, only one image can be contained. I wonder Imagelist_LoadBitmap always creates an imagelist initially with only one image contained?
When you create the image list, you specify the size of each image. LoadBitmap will divide the loaded image into appropriate sub-rectangles. The bitmap should contain properly sized images laid out horizontally.