Hi list,
sorry, i know its bad style to ask nearly the same question twice, but i
make no progress with this problem. All in this file works well, except the
getline command. Allways the program crashed at this point. No exception, no
message, nothing. Has anyone a idea ?
Thanks in advance !!
greetings
Horst
// File: readdata.cpp
// Last: 6.8.02
#include "readdata.h"
#ifndef PROCABI_H
#include "procabi.h"
#endif
#ifndef DATEI_H
#include "datei.h"
#endif
#ifndef INOUT_H
#include "inout.h"
#endif
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <iostream>
#include <fstream>
using std::cout;
using std::cerr;
using std::getline;
extern TProzessfaehigkeit pf;
extern TRead read;
//-------------------------------------------------------------------
bool isLine2Skip(const string& s) {
return ( (s[0] == ';') || // Comment
(s[0] == ' ') || // Space
s.empty() ); // Empty String
} // bool isLine2Skip()
int RdFile(const string& s) {
try {
ifstream in(s.c_str());
if (!in) throw ERR_FILE_OPEN;
string line;
do {
getline(in, line);
} while (isLine2Skip(line));
pf.MeanS = atof(line.c_str());
do {
getline(in, line);
} while (isLine2Skip(line));
pf.UTG = atof(line.c_str());
do {
getline(in, line);
} while (isLine2Skip(line));
pf.OTG = atof(line.c_str());
while (getline(in, line)) {
if (!isLine2Skip(line)) pf.Add(atof(line.c_str()));
} // while
return 0;
} // try
catch(...) {
cerr << " Fehler in Datei " << s << endl;
return 1;
} // catch
} // int RdFile()
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
|