1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#ifndef BINARY_H
#define BINARY_H
#include <string.h>
#include "fs.h"
/*---------------------------------------------------------------------------*/
#define FLOAT_BYTES 4
#define INDEX_BYTES 4
#define SHORT_BYTES 2
#define ARRAY_BYTES(n) (FLOAT_BYTES * (n))
#define STRING_BYTES(s) (strlen(s) + 1)
void put_float(fs_file, float);
void put_index(fs_file, int);
void put_short(fs_file, short);
void put_array(fs_file, const float *, size_t);
float get_float(fs_file);
int get_index(fs_file);
short get_short(fs_file);
void get_array(fs_file, float *, size_t);
void put_string(fs_file fout, const char *);
void get_string(fs_file fin, char *, size_t);
/*---------------------------------------------------------------------------*/
#endif
|