help-octave
[Top][All Lists]
Advanced

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

strings parameters in C++ subroutine


From: John W. Eaton
Subject: strings parameters in C++ subroutine
Date: Tue, 5 Oct 1999 00:55:12 -0500 (CDT)

On 29-Sep-1999, Don Fisher <address@hidden> wrote:

| How does one convert a string parameter to a standard null terminated C
| type string. I have been able to decode numeric values using 
| 
| value = (int) args(1).double_value();
| 
| type calls. But I do not know how to construct the same for character
| strings.

For a single string, you can use something like

  string str = args(1).string_value ();

  char *c_str = str.c_str ();

For a vector of strings, you can use

  string_vector str_vec = args(1).all_strings ();

(I know, it should probably be called `string_vector_value', not
`all_strings').  These methods are declared in ov.h.

| Is there documentation on how the arg lists and return value lists are
| formatted?

Unfortuantely, the only real documentation on Octave internals is the
source.

jwe



---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

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