-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbits.h
More file actions
40 lines (33 loc) · 680 Bytes
/
Copy pathbits.h
File metadata and controls
40 lines (33 loc) · 680 Bytes
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
32
33
34
35
36
37
38
39
40
#ifndef BITS_H_
#define BITS_H
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#define BUFFMAX 4096
#define BITREAD 0
#define BITWRITE 1
#define BITCLOSED 2
#define BITESIZE 8
typedef
unsigned char
byte_t;
typedef
unsigned long long int
bcount_t;
typedef struct bitfile {
byte_t buffer[BUFFMAX];
int bit_pos;
int byte_pos;
int byte_num;
int fd;
int mode;
}BITFILE;
BITFILE *bit_open(char *path, int mode);
byte_t bit_close(BITFILE *bd);
int bit_read(BITFILE *bd);
void bit_rewind(BITFILE *bd);
void bit_write(BITFILE *bd, int bit);
#endif