#include <iostream> #include <fstream> using namespace std; main(void) { char *p = "hello there"; ofstream out("test"); if(!out) { cout << "Cannot open file"; return 1; } while(*p) out.put(*p++); out.close(); return 0; }