Mercurial > hg > octave-lyh
comparison src/load-save.cc @ 3775:13905c3a24af
[project @ 2001-02-06 01:56:59 by jwe]
author | jwe |
---|---|
date | Tue, 06 Feb 2001 01:57:06 +0000 |
parents | 7c8e3c42ed04 |
children | 7f5eeace12b3 |
comparison
equal
deleted
inserted
replaced
3774:de61a7ba91f2 | 3775:13905c3a24af |
---|---|
3285 // go with the "if" below!!!!! | 3285 // go with the "if" below!!!!! |
3286 if (format != LS_UNKNOWN) | 3286 if (format != LS_UNKNOWN) |
3287 { | 3287 { |
3288 i++; | 3288 i++; |
3289 | 3289 |
3290 unsigned mode = std::ios::in; | 3290 std::ios::openmode mode = std::ios::in; |
3291 if (format == LS_BINARY || | 3291 if (format == LS_BINARY || |
3292 format == LS_MAT_BINARY || | 3292 format == LS_MAT_BINARY || |
3293 format == LS_MAT5_BINARY) | 3293 format == LS_MAT5_BINARY) |
3294 mode |= std::ios::binary; | 3294 mode |= std::ios::binary; |
3295 | 3295 |
4747 } | 4747 } |
4748 break; | 4748 break; |
4749 | 4749 |
4750 case LS_MAT5_BINARY: | 4750 case LS_MAT5_BINARY: |
4751 { | 4751 { |
4752 char *versionmagic; | 4752 char const * versionmagic; |
4753 TWO_BYTE_INT number = *(TWO_BYTE_INT *)"\x00\x01"; | 4753 TWO_BYTE_INT number = *(TWO_BYTE_INT *)"\x00\x01"; |
4754 struct tm bdt; | 4754 struct tm bdt; |
4755 time_t now; | 4755 time_t now; |
4756 char headertext[128]; | 4756 char headertext[128]; |
4757 | 4757 |
4844 | 4844 |
4845 message (0, "attempting to save variables to `%s'...", fname); | 4845 message (0, "attempting to save variables to `%s'...", fname); |
4846 | 4846 |
4847 load_save_format format = get_default_save_format (); | 4847 load_save_format format = get_default_save_format (); |
4848 | 4848 |
4849 unsigned mode = std::ios::out|std::ios::trunc; | 4849 std::ios::openmode mode = std::ios::out|std::ios::trunc; |
4850 if (format == LS_BINARY || | 4850 if (format == LS_BINARY || |
4851 format == LS_MAT_BINARY || | 4851 format == LS_MAT_BINARY || |
4852 format == LS_MAT5_BINARY) | 4852 format == LS_MAT5_BINARY) |
4853 mode |= std::ios::binary; | 4853 mode |= std::ios::binary; |
4854 | 4854 |
5086 { | 5086 { |
5087 std::string fname = file_ops::tilde_expand (argv[i]); | 5087 std::string fname = file_ops::tilde_expand (argv[i]); |
5088 | 5088 |
5089 i++; | 5089 i++; |
5090 | 5090 |
5091 unsigned mode = std::ios::out; | 5091 std::ios::openmode mode = std::ios::out; |
5092 if (format == LS_BINARY || | 5092 if (format == LS_BINARY || |
5093 format == LS_MAT_BINARY || | 5093 format == LS_MAT_BINARY || |
5094 format == LS_MAT5_BINARY) | 5094 format == LS_MAT5_BINARY) |
5095 mode |= std::ios::binary; | 5095 mode |= std::ios::binary; |
5096 | 5096 |
5121 std::ofstream file (fname.c_str (), mode); | 5121 std::ofstream file (fname.c_str (), mode); |
5122 | 5122 |
5123 if (file) | 5123 if (file) |
5124 { | 5124 { |
5125 bool write_header_info | 5125 bool write_header_info |
5126 = ((file.rdbuf ())->seekoff (0, std::ios::cur) | 5126 = ((file.rdbuf ())->pubseekoff (0, std::ios::cur) |
5127 == static_cast<std::streampos> (0)); | 5127 == static_cast<std::streampos> (0)); |
5128 | 5128 |
5129 save_vars (argv, i, argc, file, save_builtins, format, | 5129 save_vars (argv, i, argc, file, save_builtins, format, |
5130 save_as_floats, write_header_info); | 5130 save_as_floats, write_header_info); |
5131 } | 5131 } |