Skip to content

Strange behavior when read after the buffer used befor #19

@Dork57

Description

@Dork57

Hello,

I read a csv-File after sending over html (AsynchronWebserver). When I read row after row and write the result to my array all works fine.

But when I read the result and check if the value == Null, the value shall not write in my array, the csv- parser seems to break.
I don't why.

this is my code:

     `CSV_Parser cp((char *)buffer, "udududud",true, ';', """");
      //cp.parseLeftover(); 
      uint16_t *Drehzahl =         (uint16_t*)cp[0]; 
      uint16_t *Kurve1 =           (uint16_t*)cp[1];
      uint16_t *Kurve2 =           (uint16_t*)cp[2];
      uint16_t *Kurve3 =           (uint16_t*)cp[3];

      cp.print();
      
      for (uint row = 0; row < cp.getRowsCount(); row++) {
          uint8_t Drehzahli = Drehzahl[row]/100;

        //NULL nicht beachten
       if(Kurve1[row]){Winkel[0][Drehzahli] = Kurve1[row];}
       if(Kurve2[row]){Winkel[1][Drehzahli] = Kurve2[row];}
       if(Kurve3[row]){Winkel[2][Drehzahli] = Kurve3[row];}
        `

The output of cp.print (important section):

CSV_Parser content:
rows_count = 221, cols_count = 4
Header:
Drehzahl | Kurve 1 | Kurve 2 | Kurve 3
Types:
uint16_t | uint16_t | uint16_t | uint16_t
Values:
0 | 0 | 0 | 150
100 | 0 | 0 | 150
.
.
.
19600 | 0 | 0 | 130
19700 | 0 | 0 | 130
19800 | 0 | 0 | 130
19900 | 0 | 0 | 130
20000 | 0 | 0 | 130
130 | 130 | 13800 | 130
130 | 130 | 13900 | 130
130 | 130 | 14000 | 130
130 | 130 | 14100 | 130
130 | 130 | 14200 | 130
130 | 130 | 14300 | 130
130 | 130 | 14400 | 130
130 | 130 | 14500 | 130
130 | 130 | 14600 | 130
130 | 130 | 14700 | 130
130 | 130 | 14800 | 130
130 | 130 | 14900 | 130
130 | 130 | 15000 | 130
130 | 130 | 15100 | 130
130 | 130 | 15200 | 130
130 | 130 | 15300 | 130
130 | 130 | 15400 | 130
130 | 130 | 15500 | 130
130 | 130 | 15600 | 130
130 | 130 | 15700 | 130
Memory occupied by values themselves = 1801
sizeof(CSV_Parser) = 40

The File ends normally after.
20000 | 0 | 0 | 130
But suddenly there are ghost values after.

Is there any explaination?
My csv.File attented.
MeineKurven.csv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions