[Kst] branches/work/kst/portto4/kst

Brisset, Nicolas Nicolas.Brisset at eurocopter.com
Thu Jun 28 09:24:57 CEST 2007


>  int AsciiSource::readFullLine(QFile &file, QByteArray &str) {
>    str = file.readLine(1000);
> +  if (str.isEmpty())
> +    return str.size();
I've never quite understood why we need that readFullLine(...) method.
As far as I understood, the idea was that if kst is given a "wrong"
ASCII file the first line could become veeeeryyyyy long, so that
initially only a given (fixed) number of bytes were read. This then led
to the problem that some people (me :-)) could not read their ASCII data
files which had *lots* of variables. So in the end we do read the whole
line... In that case, why not use QTextStream like:
if ( DataFile-> open( IO_ReadOnly ) ) {
  QTextStream  TS (DataFile);
  QString line = TS.readLine();
...

I don't know if that construct still works in Qt4, though... but if we
can simplify the code for datasources it can only help avoiding errors
and makes it easier for people willing to write new ones (Matlab's .MAT
anyone
http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_for
mat.pdf ?)

Nicolas


More information about the Kst mailing list