1094570635 发表于 2023-3-8 01:14:43

文件读写,参数问题

#include<iostream>
#include<string>
#include<fstream>
using namespace std;
//#define Name "name.txt"
inline string Name()
{
        return string("name.txt");
}

void test01()
{
        ofstream ofs;
        ofs.open(Name, ios::out);
        ofs << "name";

}
int main()
{
        test01();


        return 0;
}
代码
我定义了一个宏常量作为参数可以运行,定义了一个有返回值的string类型变量却不行
错误显示模板参数不匹配

dolly_yos2 发表于 2023-3-8 09:12:47

是否因为 Name 没有被调用所以说函数类型?
调用函数是否需要括号之类的东西?
页: [1]
查看完整版本: 文件读写,参数问题