diff liboctave/chMatrix.cc @ 1728:42b4f904f1af

[project @ 1996-01-09 11:36:01 by jwe]
author jwe
date Tue, 09 Jan 1996 11:41:43 +0000
parents 403c60daa8c7
children f236cc1c8bee
line wrap: on
line diff
--- a/liboctave/chMatrix.cc
+++ b/liboctave/chMatrix.cc
@@ -32,6 +32,8 @@
 #include <cstdio>
 #include <cstring>
 
+#include <string>
+
 #include <iostream.h>
 
 // #include <sys/types.h>  // XXX FIXME XXX
@@ -91,7 +93,7 @@
   return *this;
 }
 
-char *
+string
 charMatrix::row_as_string (int r) const
 {
   if (r < 0 || r >= rows ())
@@ -102,9 +104,7 @@
 
   int nc = cols ();
 
-  char *retval = new char [nc + 1];
-
-  retval[nc] = '\0';
+  string retval (nc, '\0');
 
   for (int i = 0; i < nc; i++)
     retval[i] = elem (r, i);