Showing results for 
Search instead for 
Did you mean: 

Return to line when writing on a text file

Go to solution

Hello to all, 


I am using a producer-consumer pattern in my VI. The producer computes several data (27 data) and passes them in a queue (the data are converted to string before). 


The consumer has to write each data in a text file. When the producer sends 27 data, it means one cycle has been completed.

I would like to write one line per cycle, meaning each time the consumer writes 27 data, it has to go on a new line (send a new line instruction).


I tried to write "\n" to the file to go on a new line, but it doesn't work, it simply writes "\n" on the text file.


How can I make a new line on a txt file?


0 Kudos
Message 1 of 6

Write a Carriage return constant to the text file



0 Kudos
Message 2 of 6

I can only guess what it is going wrong since you didn't attach the problem VI to look at.  But I'm going to guess it is a newbie mistake.


You created a string with a \n in it, but it was still set for normal display mode.  You forgot to set it to \codes display mode before typing the "\n".

0 Kudos
Message 3 of 6

@Ken_Naylor wrote:

Write a Carriage return constant to the text file



A carriage return constant is a "\r" code.  He wants the constant to the right of it for new line or linefeed code "\n".

0 Kudos
Message 4 of 6
Accepted by topic author Mahmoud63PPC
04-15-2019 08:15 AM

Newline Constant

0 Kudos
Message 5 of 6

Thank you so much, I didn't see that option before Smiley Happy

0 Kudos
Message 6 of 6