Last active
March 6, 2020 09:26
-
-
Save thexmanxyz/529a10ac6ab3434377352f24e1350d0a to your computer and use it in GitHub Desktop.
Arduino - SD.h / Ethernet.h - Buffered file read / write
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int bufferSize = 64; // buffer size you want to use | |
while(file.available()) // file you previously pointed at | |
{ | |
char buffer[bufferSize]; | |
memset(buffer, '\n', bufferSize); // don't forget to fill the buffer with \n to prevent errors on last buffer read | |
file.read(&buffer, bufferSize); // read from file | |
client->write(buffer, bufferSize); // write to client | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment