xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_Base64EncodeFile()

Encodes a file base 64.

Syntax

HB_Base64EncodeFile( <cFilename>, <cBase64File> ) --> NIL

Arguments

<cFilename>
This is a character string holding the name of the file to encode.
<cBase64File>
This is a character string holding the name of the file where base 64 encoded data is written to.

Return

The return value is always NIL.

Description

HB_Base64EncodeFile() reads an entire file, encodes it base 64, and writes the encoded data into a second file.

Info

See also:HB_Base64Decode(), HB_Base64DecodeFile(), HB_Base64Encode()
Category: Encoding/Decoding , xHarbour extensions
Source:tip\encoding\Base64.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example outlines base 64 encoding and decoding of files.
// A PRG file is encoded in a second file which is decoded into
// a third file. The contents of the original and third file are
// identical.

   PROCEDURE Main
       LOCAL cFileIn  := "HB_Base64.prg"
       LOCAL cFileOut := "HB_Base64.enc"

       HB_Base64EncodeFile( cFileIn, cFileOut )

       HB_Base64DecodeFile( cFileOut, "Test.txt" )

       ? Memoread( cFileIn ) == MemoRead( "Test.txt" ) // Result: .T.

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe