PDA

View Full Version : Creating a new directory for output files




Fenrir
Mar 19, 2007, 04:30 PM
I'm programming in C++, using Xcode as my development environment.

I have a program that saves information in log files. Currently, all of the log files get put in the same directory as the executable. However, I'd like to put the log files in a new folder created by the program that corresponds to the user id.

Is there a way to create a new folder when creating an output file?



robbieduncan
Mar 19, 2007, 04:37 PM
Note in one step. You'll have to create the folder then alter the path you are writing to. I'm not a C++ person so you'll have to wait for one to come along! I could help you in Java or Cocoa...

lazydog
Mar 19, 2007, 05:24 PM
Hi

I guess you could always use mkdir() and getuid() from stdio.h. Otherwise I think boost has some os independant file/directory manipulation stuff.

b e n