I need some help

hello .
how can I halt infinte loop (EX:this loop is to capture network packet)
by pressing any buton on keyboard and if I did that action (pressing),I gotta move to a certain label to complete the program.?
break; usually works. Can you post your loop?
1
2
3
4
5
while(1)
{
   GetLastAsyncKeyEx( ); // or something like that (win32 api google it)
   if( lastKey == somethingYoureLookingFor ) break;
}


something like that?

edit: I googled it http://msdn.microsoft.com/en-us/library/windows/desktop/ms646293(v=vs.85).aspx
Last edited on
void StartSniffing(SOCKET sniffer)
{
unsigned char *Buffer = (char *)malloc(65536); //Its Big!
int mangobyte;

if (Buffer == NULL)
{
printf("malloc() failed.\n");
return;
}

do
{
mangobyte = recvfrom(sniffer,Buffer,65536,0,0,0); //Eat as much as u can
if(mangobyte > 0) ProcessPacket(Buffer, mangobyte);
else printf( "recvfrom() failed.\n");
}
while (mangobyte > 0);

free(Buffer);
}
Topic archived. No new replies allowed.