User guide
E-70
PLI Access Routines
Synopsis
This function performs two operations:
1. It inserts a header section which contains the ‘protected
compiler directive into the output file. It also inserts some initial
header information used by the decryption algorithm.
2. It toggles the encryption flag to true so that subsequent calls to
vcsSpWriteString() and vcsSpWriteChar() will have
their data encrypted.
Returns
Non-zero if there was an error writing to the output file, 0 if successful.
Example D-30 Example of vcsSpEncodeOn
vcsSpStateID esp = vcsSpInitialize();
FILE *fp = fopen("protected.file", "w");
int write_error = 0;
if (fp == NULL) exit(1);
vcsSpSetFilePtr(esp, fp);
if (vcsSpWriteString(esp, "This text will *not* be
encrypted.\n"))
++write_error;
if (vcsSpEncodeOn(esp)) ++write_error;
if (vcsSpWriteString(esp, "This text *will* be
encrypted.\n"))
++write_error;
if (vcsSpEncodeOff(esp)) ++write_error;
if (vcsSpWriteString(esp, "This text will *not* be
encrypted.\n"))
++write_error;
fclose(fp);
vcsSpClose(esp);