Creating a new directory for output files

Discussion in 'Mac Programming' started by Fenrir, Mar 19, 2007.

  1. macrumors newbie

    Joined:
    Mar 15, 2007
    #1
    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?
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    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...
     
  3. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #3
    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
     

Share This Page