<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Golnaz,</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>did you find the source of the problem?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Have a nice day</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=golak_h@yahoo.com href="mailto:golak_h@yahoo.com">Golnaz
Honarpisheh</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org
href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, April 18, 2008 12:37
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] Code for
unhandled exceptation error</DIV>
<DIV><BR></DIV>
<DIV
style="FONT-SIZE: 10pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>Here is my code,However i think problem is not from code because even
when i make it short to open only the file i will get same error.Another thing
is that evrytime i open my file in a project i have to go to project menu and
settings to set manually the wincap.lib ,in this way there is no error in buil
process but in run time i will get myfilename.exe error and in reports shows
that message;unhandled exceptation</DIV><SPAN class=yshortcuts
id=lw_1208547201_1 style="BACKGROUND: #dceeff"><FONT color=#0000ff>
<DIV><BR>#include "pcap.h"<BR>#include <stdio.h><BR>#include
<stdlib.h><BR>#include <iostream><BR>using namespace
std;<BR>#define LINE_LEN 16<BR>void find_device(pcap_if_t
**all_devices);</DIV>
<DIV> main(int argc, char **argv)
{<BR> int
res,i=0;<BR> struct
pcap{};<BR> char
errbuf[PCAP_ERRBUF_SIZE]; /* Error string */</DIV>
<DIV> <BR> struct
pcap_pkthdr *header; /* The header that pcap gives us
*/<BR> struct pcap_pkthdr *pcap_header;<BR> const u_char
*packet; /* The actual packet */<BR> pcap_t
*handle; /* Session handle
*/<BR> char
error[PCAP_ERRBUF_SIZE];<BR> FILE
*capfile;<BR> char
*capture_file;<BR> char
*pkt_data;<BR> int
caplen;<BR> </DIV>
<DIV> pcap_t
*pcap_open_offline(char *scapturefile,char
*errbuf);<BR> <BR>
/* Grab a packet<BR> int code
=
pcap_next_ex(handle,&header,&packet);<BR>
if (code <
0)<BR>
cout << "Error in pcap_next_ex\n";</DIV>
<DIV> /* Print its
length<BR> cout << "length of
packet is" << header->len << " bytes\n";
<BR> printf("%ld: \n",
header->len);</DIV>
<DIV><BR> /* And close the session
<BR>
pcap_close(handle);<BR> return(0);
*/</DIV>
<DIV> /* Retrieve the packets from the file
*/<BR> while((res = pcap_next_ex( handle, &header,
&packet)) >= 0){<BR> /* print
pkt timestamp and pkt len */<BR>
printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec,
header->len);
<BR>
<BR> /* Print the packet
*/<BR> for (i=1; (i <
header->caplen + 1 ) ; i++)<BR>
{<BR>
printf("%.2x ",
pkt_data[i-1]);<BR>
if ( (i % LINE_LEN) == 0)
printf("\n");<BR>
} <BR>
printf("\n\n"); <BR>
} <BR> if(res ==
-1){<BR> printf("Error reading the
packets: %s\n", pcap_geterr(handle));<BR>
}<BR> <BR> return 0;</DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV></FONT></SPAN> </DIV></DIV><BR>
<HR SIZE=1>
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. <A
href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ">Try
it now.</A>
<P>
<HR>
<P></P>_______________________________________________<BR>Winpcap-users
mailing
list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>