LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Determining binary/text file in labview?( without extension )

Hi,

How can i determine if the file and binary o a text by looking at the content and without checking the extensions?

 

I find this solution but i dont know how i an do it in labview.

 Please help me if you have other method easier.

-Read first 2K bytes (or less if file is not enough big)
-If a file contains only the decimal bytes 9–13, 32–126, it's probably a pure ASCII text file
-If, in addition to the above bytes, the file contains only the decimal bytes 128–255, it's probably a text file in an 8-bit or variable-length ASCII-based encoding such as ISO-8859-1, UTF-8 or ASCII+Big5.
-If not, for some purposes you may be able to stop here and consider the file to be binary
 
-If a file doesn't meet the above constraints, examine the first 2–4 bytes of the file for a byte-order mark => UNICODE (UTF-8, UTF-16 or a text file encoded in the current code page of the host operating system)
  EF BB BF     UTF-8
  FF FE        UTF-16, little endian
  FE FF        UTF-16, big endian
  FF FE 00 00  UTF-32, little endian
  00 00 FE FF  UTF-32, big-endian


Thank you ,

0 Kudos
Message 1 of 5
(2,615 Views)

I answered this question for you on 15 May 2017, and you already accepted it as a solution.  So why are you asking it again, and proving an answer that you are rejecting?  Why don't you follow the answer that you already accepted?

 

Bob Schor

0 Kudos
Message 2 of 5
(2,562 Views)

I'm sorry, but it's not the same question ,in any case thank you I found the solution

0 Kudos
Message 3 of 5
(2,535 Views)

It sure sounds exactly the same.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 5
(2,524 Views)

The short answer is you can't because there really is no difference between a binary file and a text file except for how a human uses the data within.  Therefore, you will have to determine an algorithm that resembles what would qualify as a text file for a human being.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 5
(2,522 Views)