Writeln in p5.js

Hello my friends, I would like to save a txt file with the broken lines, but I am not finding a command similar to println to write to the .txt file

The only one I found was the write.print which unfortunately does not break the line.

I’ve already tried using write.println, but that does not work it keeps saving everything on the same line = /

Each time you call write.print() it should print a new line. You could also create a new line by writing "\n" where you want a line break.

2 Likes

Try to make this exemple with break the line, and post here please:
https://p5js.org/reference/#/p5/createWriter

why you not link us to your code?
https://editor.p5js.org/kll/sketches/BkLEziSb4

1 Like

Why am I trying to edit in the example itself.

Look at this example:
https://p5js.org/reference/#/p5/createWriter

It just saves the numbers all together on the same line, what I wanted to do is that it breaks the line to each number.

ok, problem is it works here fine, the example / and my example ( to show @Sarah ) “\n” idea
“here” is Raspberry Pi Linux RASPBIAN


so i must ask, what computer , OS, file viewer you use when you open that file from your download folder

1 Like

Look:

I do not want the example to save the numbers like this.
I wanted the example to save the numbers with broken lines like this:

I am using windows 8.

I do not know why, but in my notepad everything stays together, even with line wrapping turned on or off.

I grabbed the .txt file and threw it in the browser, showed the file with the line breaks.

so it is about the win8 notepad
pls check if there is some adjustment under the “Formatar” menu?

1 Like

No formatting only changes the font size, and activating the line break or turning off, remains the same.

The alternative I think will be to put in the browser the notepad to be able to see broken the numbers.

I do not know why notepad in windows 8 does this, the strange thing is that if you manually put the formatting with line break remains.

Thank you for helping me!