0

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?

4
Contributors
14
Replies
15
Views
9 Years
Discussion Span
Last Post by ghadahelal
0

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?

0

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.

0

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\\

0

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

0

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.

0

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

0

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

0

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?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.