From 7839401f89ccf8694de800f17df1b8737929578d Mon Sep 17 00:00:00 2001 From: cbdev Date: Tue, 20 Apr 2021 21:22:12 +0200 Subject: Fix Windows file translation --- cswave.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cswave.c b/cswave.c index 0a7d70a..0e9e344 100644 --- a/cswave.c +++ b/cswave.c @@ -9,6 +9,7 @@ #include #include #include +#include #define VERSION "0.2" @@ -211,7 +212,7 @@ static size_t process(FILE* src, size_t column, sample_format fmt, int dst, char } } - if(!*value){ + if(!*value || iscntrl(*value)){ fprintf(stderr, "Input row %" PRIsize_t " does not provide a sample column\n", samples); continue; } @@ -331,6 +332,10 @@ int main(int argc, char** argv){ return EXIT_FAILURE; } + #ifdef _WIN32 + //windows does some sort of line-ending conversion thingy unless you convince it otherwise... + _fmode = _O_BINARY; + #endif int output_fd = open(argv[2], O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); if(output_fd < 0){ fprintf(stderr, "Failed to open output file %s\n", argv[2]); -- cgit v1.2.3