When i try to run the following program:
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include \"stdafx.h\"
#include <
Try this:
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <fstream>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
std::ifstream inFile("c:\\test.txt");
if(!inFile.is_open())
{
std::cout << "Doesn't work" << std::endl;
}
inFile.close();
return 0;
}
This should work if you put your file to C:\test.txt
. The rest is up to you to figure out. Relative paths work, you need to make sure the file is where your program looks for it (or the other way 'round). Try to print out the current path if you are unsure what's wrong.