Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking at Files in Different Directory (not current directory)

Status
Not open for further replies.

mspeppa19

IS-IT--Management
Sep 26, 2002
92
US
What is the command to use to look at files in a different directory. I am writing a program that will analyze files in a directory, but the code that I have only analyzes the files in the current working directory. if i'm running my program from one directory, what is the code so that I can specify a pathname for the directory I wish to analyze.

i.e. i run my program from 'maindirectory' and i want to anaylze the contents of 'childdirectory'


Thanks!
 
Does anybody know??? I know that the command to look at files in the current directory is ... opendir(...) but when I try to specify a directory it doesn't work.
 
You should be able to do
[tt]opendir("c:\\path\\to\\dir");[/tt]

Don't forget the double \\ when writing paths in C or C++ code.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top