C0361@univscvm.csd.scarolina.edu ( Thomas Jenkins) (10/19/90)
Hello, I'm in need of some help :-) ! I'm trying to write a generic read/write unit that encrypts as it read/writes. Well, the unit works fine ( even with encrypt versions of seek and filepos! ) The trouble is that to pass any type of data structure in it must be a VAR parameter. The problem? In the encrypt write, the buffer is encrypted, so the program gets garbage back. I've gotten around this by decrypting before returning, but this is not the best solution. I decided to use GetMem and Move to create a temp buffer for the encryption like this: VAR tempBuffer : POINTER ; BEGIN IF ( MemAvail < size ) THEN BEGIN EncryptError := NOT_ENOUGH_MEMORY ; Exit ; END ; { IF } Move ( buffer , tempBuffer , size ) ; .................. BlockWrite ( f , tempBuffer , size , numWritten ) ; END ; { WriteEncrypt } Now, I'm sure there maybe an error in the POINTER stuff (I'm new to Move), but the error being reported id file not open! I call ReWrite ( f , 1 ) then writeEncrypt and it say's file not open! Can someone tell me what is wrong? I'll send the source to those interested, but I think the above is enough to show where the error is. PS., once I get this thing working, I'll post it with my password unit. I wrote this unit to encrypt the password file, but made it VERY generic so it could be used for ANY data type ( even records ). thanks, tom THOMAS E. JENKINS, JR. PROGRAMMER, UNIVERSITY OF SOUTH CAROLINA BITNET, C0361 AT UNIVSCVM.BITNET INTERNET C0361 AT UNIVSCVM.CSD.SCAROLINA.EDU