Skip to content

Commit 38e3a7c

Browse files
committed
fix: klangc can not open output file
1 parent afd23e6 commit 38e3a7c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/klangc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int klc_parse_argv(int argc, char** argv, KlCBehaviour* behaviour) {
6969
ko_delete(behaviour->textoutput);
7070
bool isfilename = argv[i + 1] && klc_isfilename(argv[i + 1]);
7171
behaviour->textoutput = isfilename
72-
? kofile_create(argv[i + 1], "rb")
72+
? kofile_create(argv[i + 1], "w")
7373
: kofile_attach(stdout);
7474
if (isfilename) ++i;
7575
if (kl_unlikely(!behaviour->textoutput)) {
@@ -90,7 +90,7 @@ static int klc_parse_argv(int argc, char** argv, KlCBehaviour* behaviour) {
9090
}
9191
if (behaviour->dumpoutput)
9292
ko_delete(behaviour->dumpoutput);
93-
behaviour->dumpoutput = kofile_create(argv[++i], "rb");
93+
behaviour->dumpoutput = kofile_create(argv[++i], "w");
9494
if (kl_unlikely(!behaviour->dumpoutput)) {
9595
fprintf(stderr, "failed to open file: %s\n", argv[i]);
9696
klc_cleanbehaviour(behaviour);

0 commit comments

Comments
 (0)