READ TEXT FILE INSIDE A DIRECTORY NOT TO INCLUDE THE COMPLETE PATH

Guys, please help me how to open text file in a directory where i am executing the c++ program. Is there a shortcut not to specify the complete path of it.

TNX.. GUYS... HOPE YOU HELP ME ASAP.. TNX..
Hey,

yeah there is a way:


1
2
3
4
5
6
7
8
#include <fstream>
#include <iostream>

int main ( )
{
     std::ifstream IStream_1 ( "MyFile.txt" ) // the .txt must be in the directory where the .exe is!
     std::ifstream IStream_2 ( "../MyFile.txt" ) // if the .exe is in C:\Folder\Xyz\my.exe - the .txt must be in C:\Folder\MyFile.txt\MyFile.txt
}


bye
Topic archived. No new replies allowed.