ToAnsi

Description

Converts a character string to an ANSI blob.

Syntax

ToAnsi ( string )

Argument

Description

string

A character string you want to convert to an ANSI blob

Returns

Blob. Returns an ANSI blob if it succeeds and an empty blob if it fails.

Usage

In PocketBuilder, the ToAnsi function converts a Unicode character string to an ANSI blob.

NoteUnicode file format Unicode files sometimes have two extra bytes at the start of the file to indicate that they are Unicode files.If the two bytes are missing, PocketBuilder assumes “little endian” format. If you are opening a Unicode file in stream mode, skip the first two bytes if they are present

Examples

Example 1

This example converts a string into an ANSI blob using the ToAnsi function and then writes the blob to a file.

integer li_filenum
blob   lblb_text
string  ls_native

ls_native = "Sample text in native format"
lblb_text = ToAnsi(ls_native)

li_filenum = FileOpen("ansi.txt", StreamMode!, & 
      Write!, LockWrite!, Replace!)

FileWrite(li_filenum, lblb_text)
FileClose(li_filenum)

See also