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...
...num, double count);
That of course should be:
>> power=pow(num, count);
Now for a couple of nitpicks.
>> cin>>num;
cin should *always* be followed up with a:
>> if(cin.good()) // safe to proceed
Finally, cin.get() can be used instead of getch(), meaning you wouldn't have to include...
...= AF_INET;
local.sin_port = port;//...also tried htons(port)...
local.sin_addr.S_un.S_addr = address;
return ::bind(sock, (sockaddr*)&remote, sizeof(remote)) != SOCKET_ERROR;
}
The two addresses I tried as the second parameter were the manifest constants INADDR_ANY and INADDR_LOOPBACK...
...it tries to resolve a dotted-decimal string to an address. If that fails, it assumes a hostname was provided.
unsigned long ip(const char * addr)
{
unsigned long address = inet_addr(addr);
if(address == INADDR_NONE)
{
hostent * host = gethostbyname(addr);
if(host)
{...
...thing is that I did this a year or so ago without any problems. :-/
And yes, in the actual program I was using something like:
hostent * host = gethostbyname("www.google.com");
if(!host)
cout << "!gethostbyname()" << endl;
else
{
memcpy(&addr.sin_addr.s_addr...
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.