Please tell folder1\folder2\...\folderN
best way to write a file to a folder folder1\folder2\...\folderN
, if only folder1\folder2\...\folderM
.
In this case, the recording is performed using std::ofstream
.
It is clear that the problem can be solved head-on - parse the path to the file and check whether each folder exists in the path and if not, create it.
But maybe / probably there is a simpler way to solve this problem?