test.rmlというファイルから一行ずつ読み出してcommandというバッファに貯めておき、最後に出力するコード
#include <SdFat.h> #include <string.h> const uint8_t chipSelect = SS; SdFat sd; ArduinoOutStream cout(Serial); char command[255]; //用意した文字列用の配列(255は適当に決めた) void Getline() { const int line_buffer_size = 18; char buffer[line_buffer_size]; ifstream sdin("test.rml"); //int line_number = 0; while (sdin.getline(buffer, line_buffer_size, '\n') || sdin.gcount()) { strcat(command,buffer); //バッファを連結していく } cout << command; //最後に全部まとめて表示する } void setup(void) { Serial.begin(9600); // pstr stores strings in flash to save RAM cout << pstr("Type any character to start\n"); while (Serial.read() < 0) {} // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with // breadboards. use SPI_FULL_SPEED for better performance. if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt(); // run the example Getline(); } void loop(void) {}