File input/output on xcode

Nov 15, 2011 at 10:56pm
I'm not sure if anyone here uses xcode, but I was wondering when I make a file were does it store it at? I know on C++ express it goes to Documents>visual studio> "project name" > "project name". I checked my xcode file but couldn't find it. Any suggestions?
Nov 15, 2011 at 11:09pm
closed account (1vRz3TCk)
'Right Click' on the file in navigation area of Xcode and select show in finer from the context menu.
Nov 16, 2011 at 12:08am
Still can't find it. I even wrote a program to write a file to see if that's where it went, still nothing.
Last edited on Nov 16, 2011 at 12:08am
Nov 16, 2011 at 12:30am
Show In Finder has been a part of almost every XCode context menu for as long as I've been using XCode... What version of XCode are you using?
Nov 16, 2011 at 12:35am
I'm using version 4.1. I know where finder is but maybe i'm doing something little wrong. Here is the code I wrote just to write a file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    ofstream Newfile;
    Newfile.open("newfile.txt");
    Newfile << "Hello ";
    
    
    
    return 0;
}


I click on the "show in finder" button but still I can't find where my newfile.txt was stored at. all I see is main.cpp
Nov 16, 2011 at 8:51am
closed account (1vRz3TCk)
Ah, I misunderstood what file you where looking for. It is likely to be in the project directory somewhere but you could just type the name into the search box of finder.
Nov 16, 2011 at 9:53am
Look in your project's directory (where the .xcodeproj file lives) and there should be a directory called "build". In there there should be a directory called "Debug" or "Release" depending on which configuration you built. In one of those should be your program's executable along with the file you just created.

Scratch that, I was using XCode 3.2.6

In XCode 4, if you look in your project navigator, there should be a folder called "Products". Expand that and you'll see your executable file. Right click (or Ctrl click if you don't have a two buttoned mouse) on the executable file and choose "Show in Finder". You should then see your executable along with the file it just created.

It seems that the build products from your project go into:
/Users/<username>/Library/Developer/XCode/DerivedData/<yourprojectname>/Build/Products/Debug

Not sure if this location can be changed, I don't use XCode 4 very much.
Last edited on Nov 16, 2011 at 10:01am
Nov 16, 2011 at 9:22pm
I Use Xcode

for some reason alot of people have this issue with Xcode for some reason it is a Product Error.. you need to go into Settings and do something within those Settings for your Project..

I just move to Netbean
Topic archived. No new replies allowed.