fix an issue in example program
This commit is contained in:
parent
f0ae9692fc
commit
a1cefa690d
@ -13,6 +13,7 @@ static inline bool acg_flush(struct acg_stream* s) {
|
||||
if (s->cursor_bits < 8U) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FILE** fp = (void*) &s->udata;
|
||||
if (NULL == *fp) {
|
||||
*fp = fopen("log.acg", "wb");
|
||||
@ -23,6 +24,9 @@ static inline bool acg_flush(struct acg_stream* s) {
|
||||
if (1U != fwrite(s->buffer, s->cursor_bits/8U, 1U, *fp)) {
|
||||
return false;
|
||||
}
|
||||
memset(s->buffer, 0U, (s->cursor_bits+7U)/8U);
|
||||
s->cursor_bits = 0;
|
||||
|
||||
if (0U != fflush(*fp)) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user