aboutsummaryrefslogtreecommitdiff
path: root/cswave.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-04-20 21:22:12 +0200
committercbdev <cb@cbcdn.com>2021-04-20 21:22:12 +0200
commit7839401f89ccf8694de800f17df1b8737929578d (patch)
tree40ddbabf46348612c65c9c7020c5265946b144ff /cswave.c
parentefa395f65a88f1457a58a51bbde62c8c1f3c7588 (diff)
downloadcswave-7839401f89ccf8694de800f17df1b8737929578d.tar.gz
cswave-7839401f89ccf8694de800f17df1b8737929578d.tar.bz2
cswave-7839401f89ccf8694de800f17df1b8737929578d.zip
Fix Windows file translation
Diffstat (limited to 'cswave.c')
-rw-r--r--cswave.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cswave.c b/cswave.c
index 0a7d70a..0e9e344 100644
--- a/cswave.c
+++ b/cswave.c
@@ -9,6 +9,7 @@
#include <fcntl.h>
#include <inttypes.h>
#include <math.h>
+#include <ctype.h>
#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]);