PDA

View Full Version : Crypted file that adds space character to end of file?!



bi0hazard
06-16-2011, 12:44 PM
Hi,

In my project, I've a basic login input box that asks the user to login to put his signature.

It's basically a crypted txt file with names and 4-number PIN.

Each time Word VBA open this and close it, it adds a space character but I don't know why because I open it using this simple crypting code:

CRYPT:

Open FilePath For Binary As #1

For X = 1 To FileLen(FilePath)
Get #1, X, crypt
Put #1, X, crypt + key
DoEvents
Next X

Close #1
UNCRYPT:

Open FilePath For Binary As #1

For X = 1 To FileLen(FilePath) - 3
Get #1, X, crypt
Put #1, X, crypt - key
DoEvents
Next X

Close #1
Space bar in txt file:
https://lh6.googleusercontent.com/-TpQ3oPrynnM/Tfpc7zloPaI/AAAAAAAAHVE/omX2673bcv8/s640/nipfile.JPG

Frosty
06-16-2011, 01:26 PM
Use Option Explicit and post a totally working code sample if you would, please. I'm not 100% sure what you want to do here.


Otherwise, I can only suggest using RTrim or Right before you close the file in one of the two routines.