how do i print this output to a text file instead of console window.i got this code also from this site. i do not want to change the function. only the output print to a txt file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
std::string next_file_name()
{
static std::string prefix = "frame" ;
static std::string suffix = ".png" ;
staticconstint ub = 100 ;
staticint n = 0 ;
return prefix + std::to_string( n++ % ub + 1 ) + suffix ; // for 1 to hunfred
}
int main()
{
for( int i = 0 ; i < 10 ; ++i )
std::cout << "file name: " << next_file_name() << '\n' ;
}