Here's a snippet code on how to write text to file. you need to include <fstream> header file also:
>> ofstream names; // names is object of ofstream
>> names.open("D://names.txt");
>> names << "1. Lady Gaga" << endl;
>> names << "2. Luna Maya" << endl;
>> names << "3. Aura Kasih" << endl;
>> names.close();or
>> ofstream names("D://names.txt");
>> names << "1. Lady Gaga" << endl;
>> names << "2. Luna Maya" << endl;
>> names << "3. Aura Kasih" << endl;
>> names.close();
No comments:
Post a Comment