Mega Code Archive

 
Categories / C++ Tutorial / File Stream
 

File output with characters

#include <fstream>   #include <iostream>     #include <string>     using namespace std;          int main(){        string str = "AAA";             ofstream outfile("TEST.TXT");      for(int j=0; j<str.size(); j++)         outfile.put( str[j] );            cout << "File written\n";        return 0;     }