I'm trying to read characters from a file and I get stuck in an infinite loop, this is the code :
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream ifs("ifile.txt", ios_base::in);
int b;
while ((b = ifs.get()) != EOF)
{
cout << b << endl;
}
}
Note that I've made a file called ifile.txt inside the project Debug folder where the .exe file is being created (I'm using Microsoft visual studio 2013)
when I run it, it get stuck in an infinite loop. Not sure why it happens but I think it might have to be with the place I've created the ifile.txt maybe ?