#1) place a cout << fname << endl; after the line fname = argv[1]; to be sure you have valid information in fname.
#2) you need to declare an ifstream object in order to associate with a file using the () operator, say maybe.
ifstream fin(file)
rather than
ifstream(file);
then be sure fin opened file before trying to use it.