From 674296b68e0963bdeda4e1b3aac1bcbeac6285a2 Mon Sep 17 00:00:00 2001 From: stephenong Date: Sat, 26 Oct 2013 00:32:49 +1100 Subject: [PATCH] Open file in binary mode so that Windows don't mangle the binary format output file. --- host/utilities/bladeRF-cli/src/cmd/rx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/host/utilities/bladeRF-cli/src/cmd/rx.c b/host/utilities/bladeRF-cli/src/cmd/rx.c index ec375e89..8dc3295e 100644 --- a/host/utilities/bladeRF-cli/src/cmd/rx.c +++ b/host/utilities/bladeRF-cli/src/cmd/rx.c @@ -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;