[Kst] Re: Bug in ASCII fixed-width

Peter Kümmel syntheticpp at gmx.net
Sat Feb 5 14:05:18 CET 2011


On 05.02.2011 10:38, Nicolas Brisset wrote:
> Hi,
>
> I think there's a bug in reading ASCII data with fixed-width columns.
> Try to read CStk and Yaw_rate from sample_data/TWIN1+fixed-width+whitespace+unixEOL+dot-decimal-separator.txt with the following settings:
> - data starts at line: 5
> - read field names from line: 3
> - read units from line: 4
> - all columns have the same width: 13 characters
> - decimal separator: dot
>
> and compare with the results obtained with:
> - data starts at line: 5
> - read field names from line: 3
> - read units from line: 4
> - space/tab delimited
> - do not make assumptions on column width (or the other setting, both work...)
> - decimal separator: dot
>
> There's a *major* problem!

Fixed.

>
> On a related note, I was wondering what happens if we indicate fixed-width but there are some characters missing at the end of the last column (like stripped whitespace). It should not crash, and if possible even read the results correctly. I haven't tried yet, so maybe it already works, but I see potential for problems there.

For each number we calculate the position by starting at the beginning of the row by adding an offset:
	_rowIndex[i] +  col_start
so it is not important how long the last column is.

But reading could we a bit faster if we have a constant row length,
then we could use a constant integer in the loop which should be faster
than looking up the index for the row start.

>
> Nicolas
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>


More information about the Kst mailing list