Solved

Getting a list of files in a directory

Posted on 2000-03-06
5
211 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

688 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