?
Solved

Getting a list of files in a directory

Posted on 2000-03-06
5
Medium Priority
?
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
msmits earned 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

801 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