Uses put() to write all characters from zero to 255 to a file
#include <iostream> #include <fstream> using namespace std; int main() { int i; ofstream out("CHARS_File", ios::out | ios::binary); if(!out) { cout << "Cannot open output file.\n"; return 1; } // write all characters to disk for(i=0; i<256; i++) out.put((char) i); out.close(); return 0; }