Solved

Getting a list of files in a directory

Posted on 2000-03-06
5
204 Views
Last Modified: 2010-04-02
I want to get a list of all the *.html files in a certain directory, say c:\temp. I use CBuilder and know about the findfirst/findnext functions, but these seem to be windows specific. Is there a unix compatible way of doing it?
Any help appreciated.
0
Comment
Question by:friberg
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
msmits earned 50 total points
ID: 2589613
You might want to look at:

opendir()
readdir()
closedir()

I don't have my Borland stuff online to check availability, but those are the UNIX calls.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2589782
But CBuilder is for windows, not unix????
0
 

Author Comment

by:friberg
ID: 2590441
Thanks, those are available in both unix and windows. :)
0
 
LVL 22

Expert Comment

by:nietod
ID: 2591508
If they are available in CBuilder, they are interface functions that borland suplied to make it easier to port unix code to windows.  They are not actually windows functions, they just call the actual windows functions to do the work.  (Using them is okay, but you shoudl understand what they really are and the potential consequences of that.)
0
 

Author Comment

by:friberg
ID: 2592569
nietod, thanks for the info. I tested them, and they work fine. I really want my code to be unix portable, so this was exactly what I was looking for. It's easy to accidentally use functions that are windows only...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now