我正在尝试查看正在读取的字符串的结尾是否为".如果不是,我希望它打印出来的东西.
if(!line.find_last_of("\"")) {
cout << "Extra parameter is typed.";
continue;
Run Code Online (Sandbox Code Playgroud)
我试图使用find_last_of但是当我运行它时,无论命令是否有额外的参数,都会打印额外的参数.例:
lc "file.txt" -suppose to true so it's suppose to continue program but returns false
lc "file.txt" lk - suppose to return false and it does but should only return false for this type of case.
Run Code Online (Sandbox Code Playgroud)