User Tools

Site Tools


c_-_c_files:file_write

C - C++ Files - File write

#include <iostream> 
#include <fstream> 
using namespace std; 
 
int main() 
{ 
  ofstream out("test.txt"); 
  if(!out) 
  { 
    cout << "Cannot open file.\n"; 
    return 1; 
  } 
 
  out << 10 << " " << 123.23 << "\n"; 
  out << "This is a text."; 
 
  out.close(); 
 
  return 0; 
}
c_-_c_files/file_write.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki