Find EOF on CSV file

Hi.
I have to find the EOF (end of the file) in javaScript. I have try’d some possibilities without success.

let i  = myFile.realine();
if(myFile == EOF){
...
}

with this code appears the following message:
TypeError: table.readline is not a function

Is there some command in p5? I couldn’t find on reference

1 Like

sorry, but why not use
https://p5js.org/reference/#/p5/loadTable
get the whole file to a table

1 Like

I am. But i have to take each value, when reaches the end of the file i receive an error message. The only way is to avoid that is to know when to file end. Sorry i didn’t make it clear early.

sorry, i still not get it,
after using loadTable you not talk to the file anymore,
you talk to the table and now it is not mytable.readline?? its about ROW

https://editor.p5js.org/kll/sketches/Nk3OjSYa2

function check_table() {
  print(data.getRowCount() + ' total (data) rows in table');
  print(data.getColumnCount() + ' total columns in table');

  for (var r = 0; r < data.getRowCount(); r++)
    for (var c = 0; c < data.getColumnCount(); c++)
      print("row " + r + " col " + c + " column "+data.columns[c]+" : " + data.getString(r, c));
}
2 Likes

I am able to do what i have to with this function:
test_data.getRowCount();

thank you very much for your help :wink:

1 Like