I am writing this code to access a file in eclipse CDT
ifstream inFile;
ofstream outFile;
string next;
inFile.open(\"input.txt\");
if (inFile.fail())
{
Other than moving your source input file, you may consider changing the working directory for launching the application.
By setting "Run Configurations" > [The RUN] > "Arguments" Tab > "Working directory" from "${workspace_loc:[Project Name]}" to something else like "${workspace_loc:[Project Name]}/Release", which is the usual binary target directory for Eclipse would do.