Skip to content

Commit d0627bf

Browse files
authored
Merge pull request #116 from hcyang/windows-binary
change to the correct filemode for opening a binary file for output
2 parents 191fc14 + 0edcb7c commit d0627bf

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
@@ -332,7 +332,7 @@ int get_cooccurrence() {
332332
fid = stdin;
333333
sprintf(format,"%%%ds",MAX_STRING_LENGTH);
334334
sprintf(filename,"%s_%04d.bin",file_head, fidcounter);
335-
foverflow = fopen(filename,"w");
335+
foverflow = fopen(filename,"wb");
336336
if (verbose > 1) fprintf(stderr,"Processing token: 0");
337337

338338
/* For each token in input stream, calculate a weighted cooccurrence sum within window_size */
@@ -343,7 +343,7 @@ int get_cooccurrence() {
343343
fclose(foverflow);
344344
fidcounter++;
345345
sprintf(filename,"%s_%04d.bin",file_head,fidcounter);
346-
foverflow = fopen(filename,"w");
346+
foverflow = fopen(filename,"wb");
347347
ind = 0;
348348
}
349349
flag = get_word(str, fid);
@@ -385,7 +385,7 @@ int get_cooccurrence() {
385385

386386
/* Write out full bigram_table, skipping zeros */
387387
if (verbose > 1) fprintf(stderr, "Writing cooccurrences to disk");
388-
fid = fopen(filename,"w");
388+
fid = fopen(filename,"wb");
389389
j = 1e6;
390390
for (x = 1; x <= vocab_size; x++) {
391391
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)