# C++ and XCode Question



## huck (Mar 1, 2004)

I'm writing some code in Xcode using C++.  Where do I need to put files (ie text files that contain data) so i can input the data from them.  Currently I have them in the folder in which the project resides.  I reference them using  this code: fin.open("file.txt");.  When i run the program it says "can't load input file".  Any suggestions?

peace.


----------



## anarchie (Mar 1, 2004)

Double-click on your program's executable under "Executables", and under "Runtime", set the working directory to the project directory.  By default, it is the build products directory.


----------



## huck (Mar 2, 2004)

good stuff...thanx a bunch.

peace.


----------



## wadesworld (Mar 3, 2004)

Keep in mind however that that is a solution for running in XCode only.

If you want to actually send your application to someone, you'll need to learn how to discover the path to yourself and set your own working directory programmatically.

Wade


----------



## macuni (Jan 11, 2009)

hello
im able to load a txt file in my c++ program and view its contents using debugger. Id like to be able to compare a users input to any of the values but

1. Im typing the values as: 1,10,100,1K,1M etc. When I look in the debugger it shows the commas, what is the correct way of seperating the values so the program reads individual values and not the commas?

2.what is an example of a command to compare a users input to data withina text file once its loaded?

any help is appreciated.

thanks


----------

