Answers for "C++ file streams"

C++
0

write to file in C++

ofstream myfile;
myfile.open("file.txt");

myfile << "write this to file"
Posted by: Guest on July-01-2020
0

c++ stream string into fiel

#include <fstream>
#include <string>
#include <iostream>

int main()
{
    std::string input;
    std::cin >> input;
    std::ofstream out("output.txt");
    out << input;
    out.close();
    return 0;
}
Posted by: Guest on July-03-2020

Browse Popular Code Answers by Language