CryptoSys PKI Pro Manual

C/C++ users must add one to this value...

The VBA examples in this manual use the VBA String() function to pre-dimension a string output buffer, where nChars is number of characters to be written to the output string.

Dim strOutput As String          ' VBA string type
strOutput = String(nChars, " ")  ' Len(strOutput) = nChars
IMPORTANT: C/C++ users must add one to this value when allocating memory.
char *szOutput;                 // C string type
// nChars = number of characters required in output string
szOutput = malloc(nChars + 1);  // add one to the number of characters

Note that this is only for a C string type (char *szOutput). For byte arrays, (unsigned char *lpOutput), use the exact number of bytes in your C/C++ code.

Dim lpOutput() As Byte      ' VBA byte array type
ReDim lpOutput(nBytes - 1)  ' VBA array of exactly nBytes (0..nBytes-1)
unsigned char *lpOutput;    // C byte array type
// nBytes = number of bytes required in output byte array
lpOutput = malloc(nBytes);  // exact number of bytes
[PREV: Cautions for C/C++ Users...]   [Contents]   [Index]   
   [NEXT: Examples of C code...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.