Error Loading File in c++

  • Thread starter Thread starter Brown12345
  • Start date Start date
B

Brown12345

Guest
I want to read a file and store the numbers in an array.

I am using a static link library and created a file in this library(.cpp in resource files). Now I am just referencing it to the program. But I get an error in loading the file. Why is it so?


void fileReading()
{
int array[7];
std::ifstream InputFile("inputFile.txt");


if (InputFile.is_open()) {

int count = 0;

while (!InputFile.eof()) {
std::cin >> array[count];
std::cout << array[count] << std::endl;
count++;
}
}

else
{
std::cout << "Error Loading file";
}
InputFile.close();
}

The above is my code made in the library.

Below is where I have created the file:

1374542.png

It would be great if anyone can help. Thanks in Advance :)

Continue reading...
 
Back
Top