Skip to content

Commit

Permalink
Fix output file creation in streaming_onlineliblinear_sparse examples
Browse files Browse the repository at this point in the history
there's absolutely no need for creating and opening the output
file prior writing into it in case of WIN32
  • Loading branch information
vigsterkr committed Jan 27, 2017
1 parent 7f99a66 commit a50a3ab
Showing 1 changed file with 2 additions and 3 deletions.
Expand Up @@ -35,17 +35,16 @@ int main(int argc, char* argv[])
float64_t C = 1.0;
char *train_file_name = (char*)"../data/train_sparsereal.light";
char *test_file_name = (char*)"../data/test_sparsereal.light";
char filename_tmp[] = "test_sparsereal.light.labels.XXXXXX";
char filename_tmp[] = "test_labels.XXXXXX";
#ifdef _WIN32
int err = _mktemp_s(filename_tmp, strlen(filename_tmp)+1);
ASSERT(err == 0);
int fd = open(filename_tmp, O_CREAT|O_RDWR);
#else
int fd = mkstemp(filename_tmp);
#endif
ASSERT(fd != -1);
int retval = close(fd);
ASSERT(retval != -1);
#endif
char *test_labels_file_name = filename_tmp;

if (argc > 4) {
Expand Down

0 comments on commit a50a3ab

Please sign in to comment.