I’m trying to read a file called “sample.txt” but whenever i try to do an ifstream, it can never locate the file. So my question is where do you put the file so that it can be located?
ifstream iFile("sample.txt");
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is the solution.
1) Open your project in Xcode;
2) Locate the Products folder in the Groups & Files tree on the left side of your Project window;
3) When you expand that folder, you should see the icon for the Unix Executable File (usually a black rectangle);
4) Ctrl-click on that icon and select Show in Finder_ (If you accidentally choose Open With Finder, the Finder will start your program in a Terminal window);
5) Show in Finder should bring up a Finder window showing the contents of the folder which includes your executable. You should see your output files in that window.
Source: https://discussions.apple.com/thread/2145737?start=0&tstart=0