Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino SD class / File class: feature request: readln() missing (... and more...) #11635

Open
dsyleixa opened this issue Jul 25, 2021 · 2 comments
Labels
Component: Core Related to the code for the standard Arduino API feature request A request to make an enhancement (not a bug fix)

Comments

@dsyleixa
Copy link

dsyleixa commented Jul 25, 2021

a method
.readStringUntil(EOL) or perhaps a new .readln()
is missing: to read an entire textline all at once until end of line, discarding any EoL/LF/CR
(e.g., text files on an SD may have \n or \r\n at EoL, so readStringUntil('\n') or readStringUntil('\r') may fail or mess it up)

edit, perhaps sth like my workaround

File SD_File;
String buf;
buf = SD_File.readStringUntil('\n');
int blen=buf.length();
if( blen>=1 && buf[blen-1]=='\r' ) buf.remove(blen-1, 1);
@per1234 per1234 added Component: Core Related to the code for the standard Arduino API feature request A request to make an enhancement (not a bug fix) labels Jul 25, 2021
@dsyleixa dsyleixa changed the title Arduino SD class: feature request: readln() missing Arduino SD class / file class: feature request: readln() missing Aug 10, 2021
@dsyleixa dsyleixa changed the title Arduino SD class / file class: feature request: readln() missing Arduino SD class / File class: feature request: readln() missing Aug 10, 2021
@dsyleixa dsyleixa changed the title Arduino SD class / File class: feature request: readln() missing Arduino SD class / File class: feature request: readln() missing (... and more...) Aug 11, 2021
@dsyleixa
Copy link
Author

dsyleixa commented Dec 29, 2021

PS;
similar to

#include <SD.h>
File myFile;
SD.remove("example.txt");

now additionally rename and copy functions would be appreciated:

int SD.rename("example.txt", "newname.txt");
and
int SD.copy("example.txt", "newname.txt");

Return value
If the file is successfully renamed or copied, a zero value is returned.
On failure, a nonzero value has to be returned.
Perhaps, an errno variable is also set to a system-specific error code on failure.

@dsyleixa
Copy link
Author

additionally, in <SD.h> some functions seem to be undocumented (https://www.arduino.cc/en/reference/SD), e.g.:

File myfile;
myFile.readStringUntil(terminator)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Related to the code for the standard Arduino API feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

No branches or pull requests

2 participants