   opening a file in C++ not working!
  Below is my code. This is my first C++ proggy that opens a file(and my first harder C++ proggy) after getting the location from the user. I get an error on the ifstream line in dev-c++.This is the error: 28 C:\Programming\my projects\main.cppno matching function for call to `std::basic_ifstream >::basic_ifstream(std::string&, const Thanks for any hlep    #include <iostream>#include <stdlib.h>#include <fstream>#include <string>using namespace std;string dir; // holds the directory that the file exists instring tmp; //this is the temperary file line stringint main(int argc, char *argv[]){  cout << "\nWhere is the file located you want to open?";  getline(cin, dir);  if( dir != "" )  {  ifstream source( dir, ios::in);  {   while(!source.eof())}  source.getline(cin,tmp); cout << tmp; source.close(); }   else {cout << "file not found" << endl;}    return 0;}My Homepage | My Forums Please Register | Google | Sharp Basic - Coming summer 2004! Wanna Beta test? Clicky! [edited by - jumpjumpjump on March 23, 2004 7:19:30 PM][edited by - jumpjumpjump on March 23, 2004 7:20:04 PM]
  well a you have getline backwardssource.getline(tmp,cin);is correct, also cin is a void* and it needs and int/number   Sharp Basic - Coming summer 2004!Sign Up For Sharp Basic Beta Testing!!!;  ifstream probably is expecting a char * for the file name, not a string. Try:ifstream source( dir.c_str(), ios::in); ;  I think you might also be missing an open brace ( { ) ;  Yeah i knowI was told that a second ago on an im My Homepage | My Forums Please Register | Google | Sharp Basic - Coming summer 2004! Wanna Beta test? Clicky!  ;  at another glace i see more errors! #include <iostream>#include <stdlib.h>#include <fstream>#include <string>using namespace std;string dir; // holds the directory that the file exists instring tmp; //this is the temperary file line stringint done=0;int main(int argc, char *argv[]){  cout << "\nWhere is the file located you want to open?";  getline(cin, dir);  while(!done)  {  if(ifstream(dir))  {    ifstream source( dir, ios::in);  while(!source.eof())   { source.getline(cin,tmp); cout << tmp; source.close();   }   }    else    {cout << "file not found" << endl;    }   }    return 0;} that should do it Sharp Basic - Coming summer 2004!Sign Up For Sharp Basic Beta Testing!!!