I am having problems with a simple file I am trying to create. The idea of the file is to use a header to read something from the file and then call this in the main.cpp
This is my Main.cpp file:
#include <iostream>
#include <string>
#include "Menu_Screen.h"
using namespace std;
int main()
{
cout << line;
}
And this is my header file:
#ifndef MENU_SCREEN_H_INCLUDED
#define MENU_SCREEN_H_INCLUDED
#include <string>
#include <fstream>
using namespace std;
{
ifstream File ("Test.txt");
string line;
while (File.good())
{
getline(File, line);
}
}
#endif // MENU_SCREEN_H_INCLUDED
In the header file, it claims that there is an unqualified-id on line 9 however I cannot see what is wrong with my code and when searching google, I can't find anything that I can either understand or make relevant to my code.
Any help would be greatly appreciated.