Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_codelvl( <cfilespec> ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_CODELVL( <cFilespec> )


Parameters

<cFilespec>
Path (optional) and filename of the file to examine.


Returns

Code          Meaning
 0            Invalid key.
 1            Not encrypted.
 2            Encrypted (OK to use).
-1            Cannot be opened or cannot be found.


Description

Verifies that a file is encrypted and that the current encryption key 
is the correct one.

NetLib will open a file using the current encryption key. If the file 
is not encrypted or is not encrypted with the current key, it will be 
unusable. When you are not certain of a file's status, you can verify 
that it is encrypted and that the current encryption key is the correct 
one by first calling N_CODELVL().

You should verify that .NTX and .DBT files associated with an encrypted 
.DBF file were encrypted with the current key before attempting to use 
them as encrypted files.

Note  The function N_CODELVL() previously verified only DBF files. 
It now works for any file.


Example

// Check if file can be used with current SETKEY
N_SETKEY(cKeyVal )

nStatus = N_CODELVL('custfile.dbf')
DO CASE
   CASE nStatus = 0
      ? 'Incorrect encryption key for CUSTFILE.DBF.'

   CASE nStatus = 1
      ? 'CUSTFILE.DBF is not encrypted.'

   CASE nStatus = 2
      USE custfile
   OTHERWISE
      ? 'File error'
ENDCASE



See Also: N_DECODE() N_ENCODE() N_SETKEY()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson