contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
Binary input conversion  
 

Introduction

This complete sample program shows how to switch the bytes in a file from a source with Code-2 style ordering (low pair before the high pair, high byte before the low byte within a pair) to a Code-0 style ordering (highest byte first, lowest byte last, in every four bytes). For every four bytes in the input (and whatever remains at the end of the file), the program carries out a binary-input conversion using the input code of 2 on the bytes captured in the pattern variable word, and placing the result in the counter i. It then converts that string to its output representation, as determined by code 0, and writes that representation to the output stream.

The program shows how the declarations set up the actual processing of the program. Alternatively, the two binary declaratioins could have been left off and replaced with explicit codes used to direct the conversion, as in this program:

  cross-translate

  find any {1 to 4} => word
    local counter i
    set i to word binary 2
    output "%4f0b(i)"



Sample

  cross-translate
  binary-input 2
  binary-output 0

  find any {1 to 4} => word
    local counter i
    set i to binary word
    output "%4fb(i)"

   
----  

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:01:41 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.