hi all
have anyone any idea how can i make my program read 3 or 4 files ,in a folder.
i mean my input isn't only one file, it's a folder.
can the C++ do that?

C++ doesn't know what a folder is. That kind of operation is dependent on the operating system, and the solution will use a system specific function or class of functions. So, what compiler and OS are you using?

yeah, its just like reading any other files. Just instead of the file name, but the path to the file. If your using windows you need two backslashes.

thanks alot for helping.
1. i'm using vc++ 6 and windows 2000
2.
u mean i'll wirte the whole path of folder and at the end i'll put //
ex.
D:\projects\\inputfolder
or D:\projects\inputfolder\\

I mean lets say you have three text files in one folder.

the path for them would be:

c:\\<whatever>\\yourfolder\\file1
c:\\<whatever>\\yourfolder\\file2
c:\\<whatever>\\yourfolder\\file3

I'm reasonably sure that's not what he wants.

whats he want then?

He probably wants to be given a folder and open the files in that folder. Your solution assumes that he already knows the names of the files in the folder and the number of files is a constant.

and now what is new!!
i used to write it :
C:\folder1\folder2\file1.txt and it works.
now i need to give only the path for the folder and the program reads all the files in this folder
ex:
c:\folder1\folder2

and the c++ program reads all the files in this folder

So do you have a solution without using system calls?

yes , you are right.
that's what i need .
to open a folder not a file

Do you want to read the contents of the folder?

yes i need to read all the files in this folder.
assuming that i'll open them before the program runs.,has the c++ this porperty?

thanks alot it was that exactly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.