LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save string in a file with special-chars

Solved!
Go to solution

Hello,

i´m usingthe MD5-llb to create a password.

Then i  want to save this MD5-string to a file and later read it back abd compare.

Works perfect with one proplem:

Some word create a "\r" in the MD5-string and when i save this string to a file and read it back then its read back as a "\n" so that the compare is not working.

My question is: How can i save a string exactly like it is to somewhere and read it back (also invisible chars)

 

For example the word: heinz

 

is in MD5: \r\FB^\07\A6\07T\C7\D9\C2\94\AB\C9\1DS\95 (string indicator as codes display)

 

when i save the string to a file then i rerad back: \n\FB^\07\A6\07T\C7\D9\C2\94\AB\C9\1DS\95

 

I used the "write text file" and "read text file"

 

What do i have to use to save and read the same?

 

Thx

 

0 Kudos
Message 1 of 9
(2,919 Views)
I believe an MD5 hash is 16 bytes long. Use the binary read and write file I/O functions and specify the length of the data to be read or written.

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 9
(2,914 Views)

Seems to work.

Now i read back \00\00\00\10\r\FB^\07\A6\07T\C7\D9\C2\94\AB\C9\1DS\95

 

The question is only why there are 4 bytes offset? The first 4 bytes are always 00 00 00 10?

What does this mean?

0 Kudos
Message 3 of 9
(2,908 Views)
Solution
Accepted by topic author OnlyOne
Have you tried right clicking and unselecting 'Convert EOL'?
Message 4 of 9
(2,906 Views)

The 10 (16 in decimal) is the string length. Set the input "prepend array or string size" to FALSE.

 

Message 5 of 9
(2,904 Views)

Hi Dennis,

this solved my problem. Thx for the tipp

0 Kudos
Message 6 of 9
(2,893 Views)

Hi dan_u,

thx for the information. But i dont have an input "prepend array or string size".

 

0 Kudos
Message 7 of 9
(2,890 Views)

In the binary write function this input exists. In the text function of course it doesn't.

 

Message 8 of 9
(2,866 Views)

Hm, now at the second look there is the input.

I dont know where i looked before.

Thx for the help

0 Kudos
Message 9 of 9
(2,864 Views)