开发者

What is the output destination of ofstream?

开发者 https://www.devze.com 2023-01-12 02:48 出处:网络
In the following C++ function: void save_data(std::ofstream& csv) { csv << \"a message\"; } Something I don\'t understand: if save_data is called, where开发者_JS百科 does it

In the following C++ function:

void save_data(std::ofstream& csv) {
    csv << "a message";
}

Something I don't understand: if save_data is called, where开发者_JS百科 does it write to? To a file? How exactly is it used?


An ofstream represents a file on the file system:

int main()
{
    ofstream  file("Plop.txt");

    save_data(file);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消