LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Return to line when writing on a text file

Solved!
Go to solution
Highlighted

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
(96 Views)

Write a Carriage return constant to the text file

 

Ken

0 Kudos
Message 2 of 6
(91 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
(90 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
(84 Views)
Solution
Accepted by topic author Mahmoud63PPC
04-15-2019 08:15 AM

Newline Constant

0 Kudos
Message 5 of 6
(80 Views)

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

0 Kudos
Message 6 of 6
(58 Views)