<!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>Do the samples in the wpdpack read the file you created?
I'm referring to the readfile/readfile_ex.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The small amount of code that you posted seems ok to me, so
either the file is corrupted or there is some error in the code that you didn't
post.</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><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </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=gianluca.varenni@cacetech.com
href="mailto:gianluca.varenni@cacetech.com">gianluca.varenni@cacetech.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</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> Wednesday, April 16, 2008 10:23
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> question</DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT><BR></DIV>
<DIV
style="FONT-SIZE: 14pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>Hello,</DIV>
<DIV>I have a problem in Winpcap programming. I want to write a program to
open the Scapture.pcap file which I already have it from wireshark and is save
file on my computer and i want to read it and print the packets for me for
later processing. This is the code i have written but pcap_next_ex doesnt
work,please guide me.Thanks</DIV>
<DIV><FONT face="Courier New" size=2></FONT><FONT face="Courier New"
size=2></FONT><BR><FONT size=2>#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);</FONT></DIV>
<DIV><FONT size=2> main(int argc, char **argv)
{<BR> int
res,i=0;<BR> struct
pcap{};<BR> char
errbuf[PCAP_ERRBUF_SIZE]; /* Error string */</FONT></DIV>
<DIV><FONT size=2> pcap_t
*indesc,*outdesc;<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>
<BR> int nb=0;</FONT></DIV>
<DIV><FONT size=2>
</FONT></DIV>
<DIV><BR><FONT size=2> 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";</FONT></DIV>
<DIV><FONT size=2> /* Print its
length*/ <BR> cout << "Jacked
a packet with length of " << header->len << " bytes\n";
</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> <BR>}</FONT></DIV>
<DIV><FONT size=2>
<BR></FONT></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></BLOCKQUOTE></BODY></HTML>