What is the output destination of ofstream?
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);
}
精彩评论