LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Carriage return sometimes works, sometimes it doesn't!

I'm writing lines of info into text files in my program. Each line of info written ends with a carriage return to keep the resulting text file clean and easy to read.

However, I have one section of code where I inserted carriage returns, but instead of getting those carriage returns, the resulting text file shows a funky ASCII character and the line of text is not spaced with a carriage return. It's identical to other sections of code that write info to the text file and the carriage return works properly in those sections of code. Anyone ever seen this?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 1 of 17
(3,530 Views)
Does the character look like a small rectangle ?
0 Kudos
Message 2 of 17
(3,498 Views)
Yup.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 3 of 17
(3,495 Views)
1/24/2005 7:00:19 PM - Off - 00:00:18
1/24/2005 7:00:37 PM - Low Heat - 00:00:32
1/24/2005 7:01:10 PM - Medium Heat - 00:00:32
1/24/2005 7:01:42 PM - Low Heat - 00:00:32
1/24/2005 7:02:14 PM - Low Cool - 00:00:32
1/24/2005 7:02:47 PM - High Cool * Loss of communication at 1/24/2005 7:03:01 PM - 00:00:19
1/24/2005 7:03:06 PM - Off - 00:00:18
1/24/2005 7:03:24 PM - High Cool - 00:00:18
1/24/2005 7:03:42 PM - Off - 00:00:18
1/24/2005 7:04:01 PM - High Cool
Unit was stopped at 1/24/2005 7:04:12 PM with a run time of 00:13:40


The above is a sample of a text file my program produces. The line "* Loss of communication at 1/24/2005 7:03:01 PM" should have a carriage return before and after it so it is on a line by itself. As you can see, the other lines of text space themselves correctly.

When I cut and pasted this text file, the rectangular ASCII character did not translate onto here, but it is present before and after the "Loss of communication" line when you examine the text file.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 4 of 17
(3,493 Views)
We've experienced the same thing.
Do you have a small example that will consistently reproduce it ?
Or can you set the hex display option on a string indicator to view the ASCII code ?
That might give a clue.
0 Kudos
Message 5 of 17
(3,488 Views)
Here's the code just from the section that writes to the text file. You can see the first and last things written to it are the carriage return. This sample code has some broken wires due to the fact I just copied one small part, so ignore those!

I keep looking at your avatar and swear I'm talking to Jerry Garcia.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 6 of 17
(3,481 Views)
Funny thing. That's exactly what I thought when I selected it !
Not that I'm a huge Grateful Dead fan. But I've been playing guitar longer than I care to remember !!!
I'm a fan of Pat Metheny and Allan Holdsworth myself. 🐵

Thanks for the example, I'll have a peek.
0 Kudos
Message 7 of 17
(3,474 Views)
Cool! Jerry Garcia is alive and well and programming in LabView! I play guitar too. Well, I used to play. If you could call it playing, it was mostly noise. I dig Pat Methany, although I'm more of a hard rock type. Nuno Bettencourt would probably be my fave.

Do you want me to include some code from the other parts of my program that write to the text file?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 8 of 17
(3,469 Views)
The clip you attached is absolutely fine from what I can see.
I stuck it in a loop and poked the output into an indicator ... no problem.
Bizarre.

Yeah, if you could include some more code.
We've got an application in the field that produces a log and every so often we see the same thing so it would be nice to get to the bottom of this !

Nuno's excellent. Loved the Extreme stuff.

Jerry
0 Kudos
Message 9 of 17
(3,459 Views)
So Extreme writes a few ballads and suddenly everyone dogged them - I never understood that. How many other bands did ballads? Pretty much all of them! For some jaw dropping guitar work at a tender age, check into Jimmy Rosenberg of Sinti. It's a different kind of music all right, but his guitar work at the age of 14 was unbeleivable.

Here is more of my code that writes to the text file. This part always seems to work fine. Again, I'm only attaching parts of the code so some lines will be broken.

And while we're on the topic, have you ever had instances where the write to file command didn't do diddly squat?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 10 of 17
(3,445 Views)