LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read characters in a binary file

I have a file written in binary format, which does not contain data but some text information, I try to read the text information out but don't know what VIs I should use. I open the file use text editor it appears something like this:
 
È}        A   A      úCš, C²«ŒÂ T)ó>IÉeD   C563 SB5POLY CONTACT .123in. DIAM ENERGY: 1;  DAMPING: 50 TP104 2
 08-09-2005‹ÿýÿçÿÿ±øÿÃíÿNàÿÒÿqÄÿ‡¸ÿ€®ÿ4¦ÿZŸÿ§™ÿÞ”ÿѐÿ[ÿïˆîÙ‡Í{®…úrÚƒ kY‚Âc))]H€"W
 
I need to extract only the text information out.
0 Kudos
Message 1 of 3
(2,993 Views)

Just convert it to a byte array. Then, in a loop, check each for e.g. "printable?" or a desired set of "lexical class" (e.g.2,3,4,5) and built a new array from the subset. At the end, convert back to string. (see attached, LabVIEW 7.1).

 

(If your string is huge, you should preallocate the array, replace at the current index, then trim it after the loop to the correct size. This optimizes memory allocations).

Message Edited by altenbach on 10-01-2005 09:27 AM

Download All
0 Kudos
Message 2 of 3
(2,993 Views)
If the file structure is always identical and you are looking for a specific section of text, just use "string subset" with the correct offset and length.
0 Kudos
Message 3 of 3
(2,988 Views)