473,811 Members | 3,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Obtain filenames from a directory (Pcap program)

Hi all,
I'm writing a program using libpcap, and I have multiple pcap files in
a folder that I want to capture.

I currently have

handle = pcap_open_offli ne("/data/traffic/pcap1.pcap", errbuf");

which works fine since pcap_open_offli ne() takes in a filename.
However, I want to process multiple pcap files from the directory /
data/traffic/ at once. Is there a way to do that?

Thank you.

Regards,
Rayne
Nov 19 '08 #1
1 2668
"lancer6...@yah oo.com" <lancer6...@yah oo.comwrote:
Hi all,
I'm writing a program using libpcap, and I have
multiple pcap files in a folder that I want to capture.

I currently have

handle = pcap_open_offli ne("/data/traffic/pcap1.pcap", errbuf");
I doubt have that. That is unlikely to even compile.
which works fine since pcap_open_offli ne() takes in a
filename. However, I want to process multiple pcap files
from the directory /data/traffic/ at once. Is there a way
to do that?
Not in standard C which is the topic of comp.lang.c.

See the FAQ...

http://c-faq.com/osdep/readdir.html

--
Peter
Nov 19 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
4369
by: Marian Aldenhövel | last post by:
Hi, I am very new to Python and have run into the following problem. If I do something like dir = os.listdir(somepath) for d in dir: print d The program fails for filenames that contain non-ascii characters.
5
7786
by: Tony Gahlinger | last post by:
In reading up on raw socket programming under RedHat 9.2, I come across 'typedef struct pcap pcap_t' in pcap.h. Ok, so pcap_t is of type pcap, but I can't find any include file that tells me what pcap is itself. Ideas, anyone? --Tony
2
8672
by: rbutch | last post by:
guys, i need a little help with this. this is working (well sort of) i get the info, but it's not moving to a new line as it iterates thru the array and all of the fields are like ONE HUGE LONG string 'declare an array Dim filenames() As String filenames = Directory.GetFiles("C:\Re_Class") Dim i, o As Integer Dim info As String
6
18576
by: I_AM_DON_AND_YOU? | last post by:
I have a small VB.Net Solution. The solution has filename LABELMAKER.SLN and the the project has filename LABELMAKER.VBPROJ. There is another file LABELMAKER.VBPROJ.USER. All these are in a directory called LABELMAKER. Everything is working fine. I just wanted to rename the directory and filenames. So I changed the directory name as "EASYLABEL" and also changed the filenames as EASYLABEL.SLN, EASYLABEL.VBPROJ and EASYLABEL.USER. So...
6
9991
by: Willie wjb | last post by:
Hi, i created a windows service. This service is installed in some c:\program files\x directory when started it needs the directory in which it is started. when i use the system.environment.currentdirectory i get the C:\WINNT\SYSTEM32 in stead of the c:\program files\x.
1
8767
by: amc river | last post by:
Hi, Anyone know of if there is a java class that extract every field of a pcap format file? thanks
5
9757
by: dananrg | last post by:
Is there a standard library module in Python 2.4 (Win32) that will return directory permissions / ACLs (e.g. users, groups, and what rights they have)? Otherwise, I'm faced with sending "cacls dirName" commands via os.popen as below, and then parsing and comparing the text output. Basically, I'd like to compare what the ACLs a directory should have against what the actual ACLs are.
0
2860
by: Astan Chee | last post by:
Hi, Im using pyflag to parse .pcap files. Pyflag displays the data part of the .pcap file in binary and I was wondering what this means. How do I decode the 'data' part of the packet without using external libraries? What does these non-alpha numerical information mean? Is there a (python) dictionary/documentation somewhere that I can use to parse this data? Thanks again. Cheers Astan
2
1947
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I work in a company where we tend to use very deep folder structures and long descriptive file names due to the nature of the analysis that we make. I've made a program that recursively descends into these folders to do some search stuff. However, I receive an exception trown from a FileInfo object when I'm deep down the mine shaft saying that "the specified path/file is too long and must not exceed 248/260 respectively in...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10652
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7673
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.