Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 5, 2012, 08:46 PM   #1
Jokerfwb
macrumors member
 
Join Date: Jan 2012
Where does Xcode save a .dat file?

I am taking a C++ class and i'm using Xcode to do all the projects, because it is just some much nicer then MS Visual, anyways. The project i'm on is about learning to read/write to a random access file using fstream and the such.
A part of the code creates a .dat file the fist time the program is ran. Everything works just fine when i compile and run but i can't seem to find where the .dat file is saved.

I have tried searching for it through finder but all it pulls up is the main.cpp file where it is created.
Jokerfwb is offline   0 Reply With Quote
Old Apr 5, 2012, 09:56 PM   #2
Sam Yikin
macrumors regular
 
Join Date: Oct 2007
Find your executable in your project window, right click, "Show In Finder", it should be in the same directory as the executable... which, because the executable is temporary, Xcode buries it deep within your ~/Library folder.

I like to make a folder in the project directory and create the file there.

EDIT: This was true in C. I assume c++ would be the same.
Sam Yikin is offline   0 Reply With Quote
Old Apr 5, 2012, 10:32 PM   #3
Jokerfwb
Thread Starter
macrumors member
 
Join Date: Jan 2012
/Users/jokerfwb/Library/Developer/Xcode/DerivedData/Assignment5-feulksjlyapgjpbrdzndpglhmygn/Build/Products/Debug

What you told me worked perfectly found the .dat file. The path i pasted is the path i get from right clicking on the file and clicking get info. The problem i have know is i can't navigate to it through Finder. After i click on user -> jokerfwb there is no library folder listed.

Also how do you go about creating a folder in the project directory and creating the file there?

Thanks
Jokerfwb is offline   0 Reply With Quote
Old Apr 5, 2012, 11:19 PM   #4
thundersteele
macrumors 68030
 
Join Date: Oct 2011
The Library folder is hidden by default. You can make it visible, e.g. following the advice from this site:
http://mac.finerthingsin.com/post/78...folder-visible

You should be able to tell the program where to save it's file. I assume that right now it is saved in a location relative to the location of the executable, which, since you are using Xcode, is hidden deep inside the library.
thundersteele is offline   0 Reply With Quote
Old Apr 6, 2012, 12:18 AM   #5
Jokerfwb
Thread Starter
macrumors member
 
Join Date: Jan 2012
thanks i'll look into that
Jokerfwb is offline   0 Reply With Quote
Old Apr 6, 2012, 12:33 AM   #6
chown33
macrumors 603
 
Join Date: Aug 2009
See this:
http://forums.macrumors.com/showthread.php?t=1285568

It shows exactly how to change the working directory for an Xcode 4 executable.

What's a working directory?
http://en.wikipedia.org/wiki/Working_directory
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:00 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC