PA_GetBlobVariable

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_GetBlobVariable (aVariable; theBlob) long

ParameterTypeDescription
aVariablePA_VariableVariable to access
theBlobvoid *Content of the BLOB variable
Function resultlongtheBlob size in bytes

Description

The routine PA_GetBlobVariable puts the content of the variable aVariable in the data pointed to by theBlob and returns its size in bytes.

If aVariable does not have the kind eVK_Blob, the routine returns 0 and theBlob is returned unchanged.

If BLOB size is unknown, call the function a first time with theBlob equal to zero. The returned value will be the size of the needed buffer. Allocate the buffer and call the function again with the correct buffer.

theBlob is a copy of the original. Simply get a handle to the BLOB by calling PA_GetBlobHandleVariable.

Example

Get a BLOB variable.

   char   *theBlob;
   long   blobSize;

   // First call the routine with a nil pointer to get the BLOB size
      blobSize = PA_GetBlobVariable(aVariable, 0L);
   // Then allocate the buffer
      theBlob = malloc(blobSize);
   // If it is ok, get the blob (duplicate it, in fact)
      blobSize = PA_GetBlobVariable(aVariable, theBlob);
   // Work with it
      /* . . . */
   // Cleanup
      free(theBlob);

See Also

PA_GetBlobHandleVariable.

Error Handling

PA_GetLastError keeps the last error that occurred before calling the routine.


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next