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

[Documentation]read(buffer, len) #52

Open
sterretje opened this issue Mar 31, 2018 · 0 comments
Open

[Documentation]read(buffer, len) #52

sterretje opened this issue Mar 31, 2018 · 0 comments
Labels
topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project

Comments

@sterretje
Copy link

sterretje commented Mar 31, 2018

https://www.arduino.cc/en/Reference/FileRead states that the read method returns a character or -1. That however only applies to ::read(). read(buffer, len) returns the number of bytes read or -1 on error.

From SDFile.cpp

//------------------------------------------------------------------------------
/**
 * Read data from a file starting at the current position.
 *
 * \param[out] buf Pointer to the location that will receive the data.
 *
 * \param[in] nbyte Maximum number of bytes to read.
 *
 * \return For success read() returns the number of bytes read.
 * A value less than \a nbyte, including zero, will be returned
 * if end of file is reached.
 * If an error occurs, read() returns -1.  Possible errors include
 * read() called before a file has been opened, corrupt file system
 * or an I/O error occurred.
 */
int16_t SdFile::read(void* buf, uint16_t nbyte) {
  uint8_t* dst = reinterpret_cast<uint8_t*>(buf);
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: documentation Related to documentation for the project labels Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants