Skip to content

Commit 5f35e9b

Browse files
authored
change to the correct filemode for opening a binary file for output
1 parent e9f0765 commit 5f35e9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cooccur.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ int get_cooccurrence() {
331331
fid = stdin;
332332
sprintf(format,"%%%ds",MAX_STRING_LENGTH);
333333
sprintf(filename,"%s_%04d.bin",file_head, fidcounter);
334-
foverflow = fopen(filename,"w");
334+
foverflow = fopen(filename,"wb");
335335
if (verbose > 1) fprintf(stderr,"Processing token: 0");
336336

337337
/* For each token in input stream, calculate a weighted cooccurrence sum within window_size */
@@ -342,7 +342,7 @@ int get_cooccurrence() {
342342
fclose(foverflow);
343343
fidcounter++;
344344
sprintf(filename,"%s_%04d.bin",file_head,fidcounter);
345-
foverflow = fopen(filename,"w");
345+
foverflow = fopen(filename,"wb");
346346
ind = 0;
347347
}
348348
flag = get_word(str, fid);
@@ -384,7 +384,7 @@ int get_cooccurrence() {
384384

385385
/* Write out full bigram_table, skipping zeros */
386386
if (verbose > 1) fprintf(stderr, "Writing cooccurrences to disk");
387-
fid = fopen(filename,"w");
387+
fid = fopen(filename,"wb");
388388
j = 1e6;
389389
for (x = 1; x <= vocab_size; x++) {
390390
if ( (long long) (0.75*log(vocab_size / x)) < j) {j = (long long) (0.75*log(vocab_size / x)); if (verbose > 1) fprintf(stderr,".");} // log's to make it look (sort of) pretty

0 commit comments

Comments
 (0)