Go Down

Topic: Using fgets vs getline in SdFat library (Read 1 time) previous topic - next topic


I have a large csv (~60k lines) on an SD card that I'd like to read one line at a time with a MEGA over the course of a month. All of the lines are the same exact length (32 characters) and end with a line return. A short example is attached.

I've been able to modify the getline and fgets examples included in the SdFat library to meet my needs. Is there any reason to use one approach over the other?

This question is prompted by the note in the getline example that this may not be the best way to read a file.

thanks for any insight.


60,000 lines in a month is about 2000 lines per day. Less than 100 per hour or slightly more than one per minute.

The only efficiency to be measured is how long it takes to write the program. Pick an example, copy it, test it and move on to the next problem.
"The problem is in the code you didn't post."

Go Up