Hello all,
I have here an stl-based scanner/tokenizer object that some of you might find useful. It is completely free.
http://flashdaddee.com/forums/attachment.php?s=&postid=97313
- Cheers
Sebastian G.
To check if a thread is running, use GetExitCodeThread(), ie:
bool thread_active(HANDLE thread)
{
DWORD status;
GetExitCodeThread(thread, &status);
return status == STILL_ACTIVE;
}
Don't use MFC, personally (thank god!). But I did notice this:
>>m_sConnectSocket.Send(LPCTSTR(m_strCardNumber), iLen);
If m_strCardNumber is an std::string, you shouldn't be casting it to a char*, since the object doesn't define an operator char*() function (implicit conversion operator).
No, you're still off.
The struct member S_addr is an unsigned long. It makes no difference.
Look:
struct foo {
unsigned long var;
};
foo bar;
int sz = sizeof(bar.var);
or...
int sz = sizeof(unsigned long);
Do you see why?
Try out a good ole C solution:
char buff[256] = "Time remaining: ";
char cat[256];
sprintf(cat, "%d", 101);
strcat(buff, cat);
printf(buff);
>> IonFilipski
Almost:
int address = 0xffffffff;
char * dangerous = (char*)address; // cast necessary
>> adholioshake
It doesn't matter whether you use ASM or C here. What *does* matter is the operating system you're running. Under a protected mode OS such as Windows, dereferencing the...
No, you didn't listen to uolj's response, it's not a compiler error, it's a keyboard error ( ie: what you typed. ;) ).
So again:
>> int count=0;
...then
>> for(int count=0;count<21;count++)
...declared again!
Luckily, there is no side effect in this case, but still, an error's an error...
Sorry about the typos. Corrected it should read:
bool bind(SOCKET sock, unsigned long address, unsigned short port = 80)
{
sockaddr_in local;
memset(&local, 0, sizeof(sockaddr_in));
local.sin_family = AF_INET;
local.sin_port = port;//...also tried htons(port)...
Hi, all. Now that I have the client functioning, I would like to complete the server. The problem I am having now is with bind()ing the listening socket. Here is the code I am using:
bool bind(SOCKET sock, unsigned long address, unsigned short port = 80)
{
sockaddr_in local;
memset(&local...
>> IonFilipski
Actually, the two are identical since S_addr is an unsigned long...
Take a look:
struct in_addr {
union {
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { u_short s_w1,s_w2; } S_un_w;
u_long S_addr; <<
} S_un;
But after looking at my code, I saw what I had...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.