LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extra space in text file line

This one is not critical, just aesthetical. My program writes lots of lines of info into a text file. One section of my code seems to include an extra empty space at the beginning of the line. The text is correct, but it just looks awkward being one space off from all the other lines of text.

I will include a sample of the section of code writing to the text file. I didn't include all of my code, so parts of the sample I'm including will show errors, but you can get the gist of what I'm trying to do.

In the line that displays "Start time of switch setting", the text is moved one spot over. Why?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 1 of 5
(3,116 Views)
I'm going to try to attach a sample text file. If you look at the first line of text anywhere after it states "Communication reestablished at (date) (time)", you will see that that line is moved one space to the right.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 2 of 5
(3,111 Views)
Hi Spaceman

I've had a look at the code and I think I can see what's happening.
If you right-click on "Format Into String" and select Edit Format String you'll notice that there is a space between each of the '%s' tokens -> "%s %s %s ..."
The format command inserts these spaces as literal text into your string. If you take them out leaving
"%s%s%s..." your problems should be solved.

I didn't get the Macaferri guitar in the end, I settled for a nice Vintage A300 acoustic. Solid top, excellent value for money and a lovely tone. Although before I got back from work our 4 year old decided to stab the cardboard box it was deliverd in with a knife, just for fun. She's put several scratches on the top. Aaaaaaaaaaaagggggghhhhhhhh!!!!!!!!!! Kids !!!

Cheers
Neil
0 Kudos
Message 3 of 5
(3,088 Views)
Just another thought.
Where you are only really combining the strings together, it is sometimes easier to use the Concatenate Strings vi. Less terminals to worry about. 😉

Cheers
Neil
Message 4 of 5
(3,085 Views)
Yup, that seemed to do the trick! I never even tinkered with "edit format string" of my "format into string" tools. I just wired my strings into them and let 'er rip.

I ended up looking into the format of my other "format into string" tools in my program and they were set up the same - a space between each %s. But only that one "format into string" tool between string lines 5 and 6 did it actually place a space in the resulting text. Weird. Nowhere else did that occur.

Thanks for the help!

And tell me about desctructive kids!! I have 4 kids - all under the age of 6! I know all about toilets clogged by toys, lipstick smeared on walls, hand lotion all over just cleaned laundry, etc.

My brother worked at a govt. contractor for a few years until he moved on to bigger and better. Years later he was browsing the stock section of the newspaper and he was reminded that he still had some stock from that company. So he glanced at the stock value listed in the paper and found he had almost $10,000 just sitting there! He bought a beautiful new Martin acoustic. I love that guitar! I have an old Fender dreadnought acoustic. I took it once to a guitar dealer to trade it in. He looked at it and handed it back and told me I better hold on to it, it was worth more than I realized. 🙂

Probably not worth enough to put 4 kids through college though.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 5 of 5
(3,058 Views)