Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fenrir

macrumors newbie
Original poster
Mar 15, 2007
5
0
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

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.