When I gather up a bunch of strings in a while loop, after I write the data to a file, the first line always has 3 spaces followed by a square. What is happening and is there a workaround to the problem. I included sample code of what Im trying to accomplish, essentially, the while loop has a string concantanation for each line in the file I am trying to write to, everything works great but the darn square problem is putting a damper on my progress.
Hi David, I think your problem could come from your way of writing into the file. It's better to write a string than an array of strings into a file. Try to convert your array into a single string and write it to the file.
I've attached an LV6.1 Version of your VI modified. Hope this helps ! Julien
It's not a bug. When an array is written to a file, there is extra information stored when the data is flattened to a string (i.e. array size). There is a shipping document entitled "LabVIEW Data Storage" that explains this (Help>Search the LabVIEW bookshelf). If you use the File Read with a data type defined as a string array, then you would get back your original string array.
Look up how arrays are stored and you'll see what's happening.
An array is a 32-bit integer, followed by the elements in the array. The integer indicates how many items follow. By flattening the array, you are including the integer in the outpout string - the first four characters, if treated as a number will tell how many elements follow.
Steve Bird Culverson Software - Elegant software that is a pleasure to use. Culverson.com