1  #include <iostream>
  2  #include <fstream>
  3  #include <string>
  4  using namespace std;
  5  
  6  int main()
  7  {
  8    fstream binaryio("city.dat", ios::out | ios::binary);
  9    string s = "Atlanta";
 10    binaryio.write(s.c_str(), s.size()); // Write s to file
 11    binaryio.close();
 12  
 13    cout << "Done" << endl;
 14  
 15    return 0;
 16  }