Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By edward_radical
#91147 Hi guys! I’ve got a file.txt saved in my LittleFS memory, which contains 30 lines. I need to iterate over the lines and divide the file in three smaller packages each with 10 lines (in order to send them to the internet). I was trying with this but I don't know if I have to create three different files (output1, output2, output3...) or I can use just one and overwrite it.
Anyone could help me? Thanks a lot

Code: Select allvoid readoutput(){
  File file ="/file.txt", "r");
    Serial.println("Error Opening File");
  } Serial.println("Success Opening File");

  File output ="/output.txt", "w");
      Serial.println("Error opening Output File");
    } Serial.println("Success opening Output File");

      int count = 0;
      String b = file.readStringUntil('\n');
        if(count == 10){
      } else {
        Serial.println("Closing output file...");
}//end readoutput