Mercurial > hg > octave-nkf
diff liboctave/str-vec.cc @ 2937:9d26524e2869
[project @ 1997-05-06 05:49:53 by jwe]
author | jwe |
---|---|
date | Tue, 06 May 1997 05:55:13 +0000 |
parents | 66ef74ee5d9f |
children | c05d4e1a9bee |
line wrap: on
line diff
--- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -29,6 +29,7 @@ #include <iostream.h> #include "cmd-edit.h" +#include "lo-utils.h" #include "str-vec.h" // Create a string vector from a NULL terminated list of C strings. @@ -57,6 +58,30 @@ elem (i) = s[i]; } +char ** +string_vector::c_str_vec (void) const +{ + int len = length (); + + char **retval = new char * [len + 1]; + + retval [len] = 0; + + for (int i = 0; i < len; i++) + retval[i] = strsave (elem(i).c_str ()); + + return retval; +} + +void +string_vector::delete_c_str_vec (const char * const *v) +{ + while (*v) + delete [] *v; + + delete [] v; +} + // Format a list in neat columns. Mostly stolen from GNU ls. ostream&