| readFormat {hexView} | R Documentation | 
Read a Binary File
Description
Read the raw binary content of a file using a description of the binary format.
Usage
readFormat(file, format, width = NULL, offset = 0, machine = "hex",
           flatten = TRUE)
Arguments
| file | The name of a file or a connection. | 
| format |  A  | 
| width | The number of bytes to print per row when displaying the file. | 
| offset | An offset within the file to start reading. | 
| machine | How to print each byte when displaying the file; either
 | 
| flatten | If  | 
Details
This function uses a "memFormat" description to
read the raw binary content of a file and interpret
sub-blocks of the file as distinct (blocks of) values.
The "memFormat" can described a nested structure of
blocks.  The flatten argument is used to convert
nested format structures to a flat (depth of one) structure.
The format is always flattened for display, but extracting
Value
A "rawFormat" object, which is a list:
| blocks | A list (of lists) of  | 
| offset | The offset in the file where reading began. | 
| nbytes | The number of bytes read from the file. | 
Author(s)
Paul Murrell
See Also
viewFormat
memFormat
as.character.rawFormat
print.rawFormat
readRaw
readBin
Examples
fileFormat <- readFormat(hexViewFile("rawTest.int"),
                         memFormat(int1=integer4, int2=integer4))
blockValue(fileFormat$blocks$int2)
fileFormat <- readFormat(hexViewFile("rawTest.int"),
                         memFormat(integers=vectorBlock(integer4, 20)))
blockValue(fileFormat$blocks$integers)