Back to the WFC main page

CBase64Coding

$Revision: 13 $

Description

This class gives you the ability to encode/decode data using base64.

Constructors

CBase64Coding()
Constructs this object.

Methods

BOOL Decode( const CByteArray& source, CByteArray& destination )
BOOL Decode( const CString&    source, CByteArray& destination )
This method takes base64 encoded text and produces the bytes. It decodes the base64 encoding.
BOOL Encode( const CByteArray& source, CByteArray& destination )
BOOL Encode( const CByteArray& source, CString&    destination )
This method takes bytes and turns them into base64 text.

Example

#include <wfc.h>

int _tmain( int number_of_command_line_arguments, LPCTSTR command_line_arguments[] )
{
   WFCTRACEINIT( TEXT( "_tmain()" ) );

   CByteArray bytes;

   get_file_contents( command_line_arguments[ 0 ], bytes );

   CBase64Coding encoder;

   CString encoded_data;

   if ( encoder.Encode( bytes, encoded_data ) != FALSE )
   {
      _tprintf( TEXT( "%s\n", (LPCTSTR) encoded_data );
   }
}

Copyright, 2000, Samuel R. Blackburn
$Workfile: CBase64Coding.cpp $
$Modtime: 1/17/00 8:56a $