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: 

write character

I have a problem with writing characters in a file. I have to write a string at EOF (in a new line --that works) and after that I want to write a 1D-spreadsheet in the next line. When I try to solve this problem, everytime the 1D-spreadsheet is immediately behind the string (when I set a carriage return after the string there is only a strange sign but not a line break....
HOw can I get a line break that my string is alone in the line...
 
Thank you very much
 
MS
0 Kudos
Message 1 of 5
(2,261 Views)

Hi

Could you attach the vi as LV7.0 (Menu File>>Save with options>>Save for previous version).

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 5
(2,248 Views)
when I set a carriage return after the string there is only a strange sign but not a line break


Carriage return is only the same as "line break" on Macintosh. On Windows, you need a Carriage return + Line Feed.


Use the NEW LINE constant to give you a line break, regardless of platform.



OTHER TIPS:


  • You don't need to use the GET DATE/TIME IN SECONDS function - the default value of the FORMAT DATA/TIME string is the current time.
  • You could use the DECREMENT function instead of subtracting one.
  • You could use the CURRENT VI's PATH and BUILD PATH functions to be more cross-platform flexible. Plus it removes absolute paths from your own code.

    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com


    Blog for (mostly LabVIEW) programmers: Tips And Tricks

    0 Kudos
    Message 3 of 5
    (2,247 Views)
    I think this VI does what you like. If so, get inspired !

    We have two ears and one mouth so that we can listen twice as much as we speak.

    Epictetus

    Antoine Chalons

    0 Kudos
    Message 4 of 5
    (2,243 Views)
    You could also consider doing this a different way.


    As I see it you are reading the entire file, replacing the last character with a line break + a new line, then re-writing the entire string.


    If your file is small, it won't matter, but as that file gets bigger, this gets more and more inefficient. Imagine a 10-meg file that you want to add a single line to. You have to read 10 megs, add a line to 10 megs, and write 10 megs.

    Consider using the raw file functions to open the file, and write the new data at the end position-1, and close the file. Super-quick, because you don't handle all the data that's gone before. See attached picture.

    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com


    Blog for (mostly LabVIEW) programmers: Tips And Tricks

    Message 5 of 5
    (2,241 Views)