简体   繁体   中英

How can I read a file (in any directory) which name(only file.txt) is passed as parameter? C++

I want to follow this schema:

    //Read filename
    string filename; 
cout << "ONLY Name of the file you want to read, not directory: "; 
cin >> filename;

    //Find file in disk C and open it
    ifstream ifs(.................);
    while( int cc = FileRead( ifs, buff ) ) {
       etc. (trivial)
    }
ifstream ifs(filename.c_str());

真的可以用谷歌搜索...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM