Save an array to a binary file. More...
Save an array to a binary file.
The saveArray and readArray functions are designed to provide store and read access to arrays using files written to disk.
The format of the file (version 1) is as follows:
Header:
Description Data Type Size (Bytes) Detailed Desc Version Char 1 ArrayFire File Format Version for future use. Currently set to 1 Array Count Int 4 No. of Arrays stored in filePer Array:
Description Data Type Size (Bytes) Detailed Desc Length of Key String Int 4 No. of characters (excluding null ending) in the key string Key Char [] length Key of the Array. Used when reading from file Offset Int64 8 No of bytes between offset and start of next array Array Type Char 1 Type corresponding to af_dtype enum Dims (4 values) Int64 4 * 8 = 32 Dimensions of the Array Data Type sizeof(Type) * dims.elements() Actual data of the arrayThe offset is equal to 1 byte (type) + 32 bytes (dims) + size of data.
An file with 2 arrays would look like (representative)
1
2
Array 1 Key Length
Array 1 Key
Array 1 Offset
Array 1 Type
Array 1 Dims
Array 1 Data
Array 2 Key Length
Array 2 Key
Array 2 Offset
Array 2 Type
Array 2 Dims
Array 2 Data
Save array allows you to append any number of Arrays to the same file using the append argument. If the append argument is false, then the contents of the file are discarded and new array is written anew.
On each append, the array counter in the header is incremented and the new array is written to the end of the file. This function does not check if the tag is unique or not.
◆ af_save_array() AFAPI af_err af_save_array ( int * index, const char * key, const af_array arr, const char * filename, const bool append )false
)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4