ONE-xicons
© Copyright 2003-2024 WERK II Medien- und Informationsgesellschaft mbH. All Rights Reserved.

char* encode_base64 (char* txt)

Create a base64 coded string of a given char* string.

Documentation

Create a base64 coded string of a given char* string. The result must deleted using release.

Name Type Default Description
Return char*   New created char* string with the base64 coded input string. Must released using release!
txt char* - any char* string
bufferLength int -1 Length of the input buffer. When this parameter is smaller or equal to 0, the length of the input buffer is determined automatically (only works for zero-terminated char* buffers!). When you want to encode binary data, provide the length of the input buffer here.

Encoding the current text and decoding this result must be equal.

int main () { StringExport Comet notes of a document. Be careful with destString, its a String not a char*. str = string::allocCreate a new self-managing string. The object must be deleted again using string::release. (); char * enc = 0; char * dec = 0; textmodel::gettextGet the text from the document. The specifications for position and length are scanner-relative. If the document text contains unicode characters, the length of the result is possibly larger than the text length in the document. (str); enc = encode_base64Create a base64 coded string of a given char* string. The result must deleted using release. (string::getGet the contents of a string as char*. The length of the contents of a string object may not be changed! (str)); dec = decode_base64Decode a base64 encoded string. The result must deleted using release. (enc); showmessageDisplay the standard dialog with a message. ("%s\n\n%s\n\n%d", enc, dec, strcmpComparison of two char*-strings. Alpha-numerical comparison of two strings. The content of an empty placeholder isn't empty but a zero width space (<0x200B>). In the following code snippet the showmessage will never reached: textmodel::get ... (string::getGet the contents of a string as char*. The length of the contents of a string object may not be changed! (str), dec)); releaseRelease memory reserved by alloc. (enc); releaseRelease memory reserved by alloc. (dec); return 0; }

Write the content of the current textmodel base64 encoded to a file. After reading and decoding this files boths strings must be equal. Take care to use a big enoug buffer while reading or read and decoded using a loop.

int main () { StringExport Comet notes of a document. Be careful with destString, its a String not a char*. str = string::allocCreate a new self-managing string. The object must be deleted again using string::release. (); char * enc = 0; char * dec = 0; char buf [3001]; int fi = 0; textmodel::gettextGet the text from the document. The specifications for position and length are scanner-relative. If the document text contains unicode characters, the length of the result is possibly larger than the text length in the document. (str); // Encode to file enc = encode_base64Create a base64 coded string of a given char* string. The result must deleted using release. (string::getGet the contents of a string as char*. The length of the contents of a string object may not be changed! (str)); fi = file::openOpen a file to read or write. Opened files must in every instance be closed again. ("$DESKTOP/txt.txt", "w"); file::writeWrite in a file. (fi, enc); file::closeClose a file (fi); // Decode from file fi = file::openOpen a file to read or write. Opened files must in every instance be closed again. ("$DESKTOP/txt.txt", "r"); file::readReading from a file. The result is written to a char*-buffer. (fi, buf, 3000); file::closeClose a file (fi); dec = decode_base64Decode a base64 encoded string. The result must deleted using release. (buf); showmessageDisplay the standard dialog with a message. ("%s\n\n%s\n\n%d", enc, dec, strcmpComparison of two char*-strings. Alpha-numerical comparison of two strings. The content of an empty placeholder isn't empty but a zero width space (<0x200B>). In the following code snippet the showmessage will never reached: textmodel::get ... (string::getGet the contents of a string as char*. The length of the contents of a string object may not be changed! (str), dec)); releaseRelease memory reserved by alloc. (enc); releaseRelease memory reserved by alloc. (dec); return 0; }

Version 3.2.2 R2366, 2803.2011

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

decode_base64

Alphabetic index HTML hierarchy of classes or Java


© Copyright 2003-2024 WERK II GmbH Duisburg
Authors :
      Paul Seidel
      Christoph Soergel
      Leo Quensel
      Mihg
This page was created using a modified version of doc++.

This documentation is part of the priint:comet InDesign®, InDesign Server® and Illustrator® plug-in and of the comet_pdf packages and is subject to the same license terms as priint:comet itself. The documentation may neither be passed on nor installed on public servers without the consent of WERK II GmbH.

The documentation describes the priint:comet scripting language cScript and provides support for solving technical problems when using the priint:comet plugins. The documentation is not a manual for the priint:comet plugins. A manual of the priint:comet plugins can be found here.

The documentation has been prepared with the greatest possible care. In case of errors or hints, please do not hesitate to contact our support. However, faulty or incomplete functional descriptions shall in no case result in an obligation on the part of WERK II GmbH to adapt the described item.

This copyright notice may not be removed or altered.