Loading...
Logo
Processing Forum
Hi,
I don't manage to export a text file with multiple lines. Each time the 1st line is rewritten :

void setup() {
  String[] isbn = loadStrings("../listeIsbn.txt"); //  *listeIsbn.txt* contain 3 lines

  for(int i=0 ; i< isbn.length ; i++){
  output = createWriter("export.txt") ;  // only one line in the .txt export
  output.println(isbn[i]) ;
  output.flush();
  output.close();
}
}

thanks

Replies(1)

Funny, somebody else recently made a very similar error.
Even if it worked, it would be very inefficient to open and close the file on each line.
Just put these operations outside of the loop, ie. keep only the println() inside the loop. Note that close() does a flush().
Or just use saveStrings()!