| 83 | */ |
| 84 | |
| 85 | void sendFile(const char *filename) { |
| 86 | |
| 87 | scoped_ptr<File> file; |
| 88 | char buffer[256]; |
| 89 | |
| 90 | // open the file - we own the file pointer that comes back upon success and |
| 91 | // we must remember to delete it when we're finished |
| 92 | |
| 93 | if(!_fs->openFile(filename,file.address())) |
| 94 | error(); |
| 95 | |
| 96 | // declare a file reader to read lines from the file and also a |
| 97 | // UsartPollingOutputStream for convenient output to the USART |
| 98 | |
| 99 | FileReader reader(*file); |
| 100 | UsartPollingOutputStream output(*_usart); |
| 101 | |
| 102 | while(reader.available()) { |
| 103 | |
| 104 | // read the next line and send to the USART |
| 105 | |
| 106 | if(!reader.readLine(buffer,sizeof(buffer))) |
| 107 | error(); |
| 108 | |
| 109 | output << buffer << "\r\n"; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | |
| 114 | /* |