Answers for "c++ stream to file"

C++
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
0

file streams in c++

$./a.out
Writing to the file
Enter your name: Zara
Enter your age: 9
Reading from the file
Zara
9
Posted by: Guest on May-01-2021

Browse Popular Code Answers by Language