help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible string bug?


From: Nick McGrogan
Subject: Possible string bug?
Date: Tue, 11 May 1999 21:31:42 +0100

Being a novice Octave user I thought I should post this here in case
I've done something really stupid, before being forward enough to
report it as a bug...

A bit weird this.  The following C++ program:

#include <octave/oct.h>
#include <octave/pager.h>

DEFUN_DLD (strtest, args, , "")
{
  string invar = args(0).string_value();
  
  octave_stdout << invar << "\n";
  octave_stdout << invar.data() << "\n";

  return args;
}

is a simple reduction to demonstrate the problem.

Given a string input this should echo it back twice to the screen,
once as a C++ string class and then as a C-style char * string.  The
second output, however, seems to get corrupted.

Typical output is:

octave:1> strtest("foo")
foo
footrtest__Fv
ans = foo

A few pertinent details...  This is octave compiled from a Redhat
Linux source RPM (octave-2.0.13-2) on a Redhat 5.2 system.  If you
need any more details then let me know...

So.  Is this a bug or am I stupid?

Nick.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]