Using Code That Opens a File and Writes to It - C++ File Stream

C++ examples for File Stream:stream

Description

Using Code That Opens a File and Writes to It

Demo Code

#include <iostream> 
#include <fstream> 

using namespace std; 

int main() //from   w  ww. j  a  v  a2 s. c om
{ 
    ofstream outfile("../MyFile.txt"); 
    outfile << "Hi" << endl; 
    outfile.close(); 

    return 0; 
}

Related Tutorials