Open file in binary mode so that Windows don't mangle the binary format output file.

This commit is contained in:
stephenong 2013-10-26 00:32:49 +11:00 • committed by Jon Szymaniak
commit 674296b68e

View file

@ -301,7 +301,12 @@ static int rx_cmd_start(struct cli_state *s)
if (status == 0) {
pthread_mutex_lock(&s->rx->file_mgmt.file_lock);
s->rx->file_mgmt.file = fopen(s->rx->file_mgmt.path, "w");
if(s->rx->file_mgmt.format == RXTX_FMT_CSV_SC16Q12) {
s->rx->file_mgmt.file = fopen(s->rx->file_mgmt.path, "w");
} else {
/* RXTX_FMT_BIN_SC16Q12, open file in binary mode */
s->rx->file_mgmt.file = fopen(s->rx->file_mgmt.path, "wb");
}
if (!s->rx->file_mgmt.file) {
set_last_error(&s->rx->last_error, ETYPE_ERRNO, errno);
status = CMD_RET_FILEOP;