C++ ofstream as parameter
#include <iostream> #include <string> #include <fstream> using namespace std; void WriteString(ofstream &file, string words) { file << words; /*from ww w . j ava2s. c o m*/ file << ";"; } int main() { ofstream delimfile("../delims.txt"); WriteString(delimfile, "a"); WriteString(delimfile, "test"); WriteString(delimfile, "this"); WriteString(delimfile, "is"); WriteString(delimfile, "a"); WriteString(delimfile, "d"); WriteString(delimfile, "I"); delimfile.close(); return 0; }