Mercurial > hg > octave-lyh
diff src/ov-list.cc @ 5717:34cda7d94c08
[project @ 2006-03-27 22:26:18 by jwe]
author | jwe |
---|---|
date | Mon, 27 Mar 2006 22:26:21 +0000 |
parents | 4c8a2e4e0717 |
children | 958e365b875e |
line wrap: on
line diff
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -536,9 +536,13 @@ for (int i = 0; i < lst.length (); ++i) { // should we use lst.name_tags () to label the elements? - char s[20]; - sprintf (s, "_%d", i); - bool b = save_ascii_data (os, lst (i), s, infnan_warned, + + OSSTREAM buf; + buf << "_" << i << OSSTREAM_ENDS; + std::string s = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); + + bool b = save_ascii_data (os, lst (i), s.c_str (), infnan_warned, strip_nan_and_inf, 0, 0); if (! b) @@ -607,11 +611,15 @@ for (int i = 0; i < lst.length (); i++) { // should we use lst.name_tags () to label the elements? - char s[20]; - sprintf (s, "_%d", i); + + OSSTREAM buf; + buf << "_" << i << OSSTREAM_ENDS; + std::string s = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); // Recurse to print sub-value. - bool b = save_binary_data (os, lst(i), s, "", 0, save_as_floats); + bool b = save_binary_data (os, lst(i), s.c_str (), "", 0, + save_as_floats); if (! b) return false; @@ -683,9 +691,13 @@ for (octave_idx_type i = 0; i < lst.length (); ++i) { // should we use lst.name_tags () to label the elements? - char s[20]; - sprintf (s, "_%d", i); - bool retval2 = add_hdf5_data (data_hid, lst (i), s, "", + + OSSTREAM buf; + buf << "_" << i << OSSTREAM_ENDS; + std::string s = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); + + bool retval2 = add_hdf5_data (data_hid, lst (i), s.c_str (), "", false, save_as_floats); if (! retval2) break;