Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:52:30+00:00 2026-06-09T15:52:30+00:00

how can i read from a file that i call data into the value

  • 0

how can i read from a file that i call data into the value x

i placed the file in the program file but keep given me

file not found..

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>

using namespace std;

double const NUMB=10;



int main ()
{
double x;

  ifstream infile;
  infile.open("data");

  if (!infile.is_open()){
    cout<<"NOT OPEN"<<endl;
    system ("PAUSE");
    exit (1);
  }

  infile >>x;

  while (infile>0){
    cout<<x<<endl;
  infile>>x;
  }

  infile.close();
  return 0;
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:52:32+00:00Added an answer on June 9, 2026 at 3:52 pm

    With Xcode the file named “data” has to be placed in the build products directory. That is, it needs to go in the same place the executable is put by Xcode after building. By default this is not the directory where the source code is. The easiest way to handle this for command line applications like this is just to include the file “data” in your project and then tell Xcode to copy the file to the build products directory whenever it builds. You do this by clicking on the project and then the target you are building. At the top of the target settings go to the “Build Phases”. The last phase should be “Copy Files”. Click “+” in “Copy Files” and select your “data” file, which will be listed as long as you have added it to the project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to read the data from a file that can be either comma
Is there way that I can read the file from remote server using fopen
Okay, so I want to have a generic method that can read data from
Hi there I have to read data from text file into the array in
how can I read consecutive structures from a file, when they have different fields,
How can I read an xls/xlsx file from a controller using Zend framework?
How can I read multiple lines at a time from a file in Ruby?
I found that you can't read from some sites using Python's urllib2(or urllib). An
I am trying to read in data from a text file (the time). and
I have to return data fetched from MySQL table into a php file as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.