#include "extern.h"
#include <fstream>
+#include <stdio.h>
using std::ofstream;
using std::ifstream;
void saveNews(char *filename, List<myString> &news)
{
- if (news.isEmpty())
- return;
-
ofstream outfile;
outfile.open(filename);
+
if (outfile.fail())
{
log("Error opening %s", filename);
while (infile.getline(buf, 1024, '\n'))
{
+ if (buf[0] == '\0' || buf[0] == '\n')
+ {
+ delete [] buf;
+ return;
+ }
string = new myString(buf);
news.insertAtBack(string);
delete string;