From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Return to line when writing on a text file

Solved!
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?


Thanks

0 Kudos
Message 1 of 6
(3,183 Views)

Write a Carriage return constant to the text file

 

Ken

0 Kudos
Message 2 of 6
(3,178 Views)

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
(3,177 Views)

@Ken_Naylor wrote:

Write a Carriage return constant to the text file

 

Ken


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
(3,171 Views)
Solution
Accepted by topic author Mahmoud63PPC

Newline Constant

0 Kudos
Message 5 of 6
(3,167 Views)

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

0 Kudos
Message 6 of 6
(3,145 Views)