i'm opening this file in my program (called astar) and the filename is an argument to the main function...so when i write out this on unix prompt (using gcc)...:
Code:
astar inputfile.txt
it works fine...but my assignment says that i don't have to give the extension...cause it can be anything.... (.in, .txt etc)...so i should be able to do this:
however using my code the above does not work and hangs the prompt...any ideas what i should do...i'm using:
Code:
\\readfile function:
void readFile (char *file)
{
ifstream fin (file);
\\then i use fin e.g. fin >> smth;
}
\\main function:
int main(int argc, char *argv[])
{
readFile (argv[1]);
}
plz help!
Farooq