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: 

Read all bytes from any file

Solved!
Go to solution

Hey! I would like to read any type of file and read them as binary (Obtain an 1d array of U8 or an 2d array 8bits x sizearray) and when I have manipulated it, rebuild the original file.

0 Kudos
Message 1 of 11
(3,467 Views)
Solution
Accepted by Pepe727

Hi Pepe,

 

I would like to read any type of file and read them as binary (Obtain an 1d array of U8 or an 2d array 8bits x sizearray)

Use ReadBinaryFile function…

 

when I have manipulated it, rebuild the original file.

Why do you want to manipulate anything, when you need the original file afterwards???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(3,462 Views)

Well such a vague question demands an equally vague answer.

 erre.PNG

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 11
(3,461 Views)

I wanna encrypt any file, for example a vi or a video or a simple .txt, so, when this file encrypted is decrypted...

 

The function "read binary file" is able to read any type of file?

0 Kudos
Message 4 of 11
(3,444 Views)

since every file is just a bunch of zeros and ones ... yes


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 5 of 11
(3,436 Views)

Does anyone have an example?

0 Kudos
Message 6 of 11
(3,431 Views)

RTSLVU had an example for the encoding,

to reverse that, you just have to do the same with F^-1 for the decoding.


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 7 of 11
(3,421 Views)

@Pepe727 wrote:

Does anyone have an example?


The "vague answer" above is actually a good starting point!  🙂

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.
Message 8 of 11
(3,419 Views)

@Pepe727 wrote:

I wanna encrypt any file, for example a vi or a video or a simple .txt, so, when this file encrypted is decrypted...

 

The function "read binary file" is able to read any type of file?


See my suggestion here https://forums.ni.com/t5/LabVIEW/Can-you-give-me-some-suggestions-for-encryption-decryption/m-p/2529...

========================
=== Engineer Ambiguously ===
========================
Message 9 of 11
(3,418 Views)

if you want to have "secure" encryption, use an external library/program that does that for you, like openssl, and not build it yourself.

you could run commandline call through the system-exec-vi.

https://zone.ni.com/reference/en-XX/help/371361J-01/glang/system_exec/


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 10 of 11
(3,407 Views)