Conversation
Ran across an issue that fgets was not supported. Looking through the forum seems like a few other people ok maybe one or two. But it also looks like a handy function to have available so added it. You can look here for a quick test: https://forum.pjrc.com/index.php?threads/problems-with-external-library-using-sdfat.77492/post-363551 Will make a similar change to the SD library.
Added fgets per the core PR: PaulStoffregen/cores#791
|
This is not something that should be implemented in the File/FS classes, the real (libc) fgets function is usable by properly implementing _read() and _write() to use File objects as int file descriptors (fds). (This is also a bad implementation - doesn't check if f is valid before calling the fgets virtual method on it.) |
|
@PaulStoffregen also for ref Here is the example from sdfat: https://github.com/greiman/SdFat/blob/cda057318bec196183d4cc92b01bc1dd64bbfb02/examples/examplesV1/fgets/fgets.ino#L16 And here is a link I posted: https://forum.pjrc.com/index.php?threads/file-abstraction-and-sdfat-integration.64136/ Of course Paul its your call. |
At @KurtE suggestion changed the virtual fgets function to be like date virtual functions.
|
Based on a suggestion by @KurtE changed the virtual fgets function call from to should
|
|
I’m with @A-Dunstan on this one. I don’t think this belongs in File either. |

Ran across an issue that fgets was not supported. Looking through the forum seems like a few other people ok maybe one or two. But it also looks like a handy function to have available so added it. You can look here for a quick test: https://forum.pjrc.com/index.php?threads/problems-with-external-library-using-sdfat.77492/post-363551
Will make a similar change to the SD library.