Given path to file by user wont work c++ -


i trying path user, insert ifstream, doesn't work. file located at: c:\test.txt used double backslash, still not working.

string pot;  cout<<"give path file:"<<endl; getline(cin,pot); //pot="c:\\test.txt"; string line; string besedilo[2]; short i=0; ifstream myfile (pot.c_str()); if (myfile.is_open()) {     while ( getline (myfile,line) )     {         besedilo[i]=line;         i=i+1;     }     myfile.close(); } 

i've tried code... , worked .txt file on d: disk. sure used double slash , wrote path. don't see other option why it's not working want.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -