关于C++ A*寻路的问题

C++ 小白。。要编一个程序通过从txt文件中读取地图,然后再通过A Star算法来寻找路径,
我们老师给了几个txt文件,要求在执行程序时输入要读取的txt的文件名来选择读哪一个,我定义了一个字符串但会报错 no matching function。
ifstream read;
string str;
cin>>str;
read.open(str);
求指点。

读进来的txt在ifstream流里。
read,或者getline 可以读出来。
寻路算法 参考 https://blog.csdn.net/diamonjoy_zone/article/details/65630144

read.open(str.c_str());

我把读入给你写完整了吧

string str, strLine;
cin>>str;
ifstream read(str.c_str());  
while (read)  
 { 
        getline(inFile, strLine); 
                //具体要怎么处理看问题
 }  

再小白也会读入了吧

不好意思变量忘改了。。。

string str, strLine;
cin>>str;
ifstream read(str.c_str());  
while (read)  
 { 
        getline(read, strLine); 
                //具体要怎么处理看问题
 }