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

George Staikos staikos at kde.org
Thu Jun 28 17:01:50 CEST 2007


On 28-Jun-07, at 3:24 AM, Brisset, Nicolas wrote:

>>  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();
> ...

   One big problem with this is that it will read an undefined amount  
of data and could crash the app if the user clicks on the wrong file.

--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/





More information about the Kst mailing list