C++ examples for File Stream:stream
Writing Strings with a Delimiter
#include <iostream> #include <string> #include <fstream> using namespace std; void WriteString(ofstream &file, string words) { file << words; //ww w . j a v a2s . co 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; }