I have modified your program for you, here is the code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream g;
char str[100];
g.open("a.txt");
while( ! g.eof() )
{
memset( &str, '\0', sizeof(str) );
g.getline(str,100);
cout<<str<<endl;
}
g.close();
return 0;
}
It has been a while since I have dealt with this, but I hope that this will help you.
Best regards and good luck!