I have a csv file stored on an sd card (test.csv). I need to send the file to the serial port as binary and view the number of bytes written.
sample code:
//open the file for reading
myFile = SD.open("test.csv);
if (myFile) {
// read from the file
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file
myFile.close();
}
according the the reference available on the website, it says write() will return the number of bytes written, though reading that number is optional .
My problem is, how do i get the number of bytes written because my next application entirely depends on this number.
according the the reference available on the website, it says write() will return the number of bytes written, though reading that number is optional .
My problem is, how do i get the number of bytes written because my next application entirely depends on this number.
"My problem is I need to know the number of bytes written." Then, discarding the output of Serial.write() is NOT optional, is it?