|
-
May 20th, 1999, 06:33 AM
#3
Re: Storing Tables in Files
If you put your lines of table data into a standard library vector or list, it's easy:
#include <vector>
#include <fstream>
#include <algorithm>
#include <string>
using namespace std;
vector<string> myTable; // array of strings for table
// fill myTable with strings here
ofstream outFile("MyFile.DAT"); // Open output file stream
// Copy myTable to outFile
copy(myTable.begin(), myTable.end(), ostream_iterator<string>(outFile));
if (!outFile.good())
{
// Handle errors here
}
Dave
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|