Encode Method

Encode the data.

Syntax

int Encode();

Remarks

This method encodes the data according to the Format type. The class will encode the data in the input stream if SetInputStream has been set to a valid stream. If this stream is null, the class will then try to read the data from the file set by the DecodedFile property. If no valid file has been specified, the class will use the DecodedData property.

The resulting encoded data is written to the output stream if one has been set. If not, the component will attempt to write the encoded data to the EncodedFile. If no file was specified, the encoded data may be retrieved through the EncodedData property.

The data is considered binary while uuencoding and Base64 Formats, and Text during QuotedPrintable ones.

When uuencoding or yencoding the filename encoded into the data is taken from the FileName property.

The current version of NetCode creates no message headers. If a MIME standard encoding is used such as Base64 Encoding or Quoted Printable Encoding the user should fill the header values appropriately.

If EncodedFile and MaxFileSize is set and the encoded data takes more space than MaxFileSize, the data is split over several files. In this case, the user can specify more than one filename by passing them to EncodedFile in the form name?. The filenames should exist as path\file0.ext, path\file1.ext ... Question marks "?" are expanded to numerals starting with 0. NetCode appends the extension ".uue", ".b16", or ".q_p" (depending on the value of Format) to the filename.

Error Handling

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 Qt Edition - Version 20.0 [Build 8307]