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?
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
and the c++ program reads all the files in this folder