[Top][All Lists]

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

Re: Passing a string to an external function

From: Teemu Ikonen
Subject: Re: Passing a string to an external function
Date: Fri, 5 May 2000 11:52:33 +0300 (EET DST)

On Fri, 5 May 2000, Ryan Shepperd wrote:

> Unfortunately, I have not been able to figure out,
> after a couple days, how to convert an Octave "string" to a "char."  I
> can access the string from inside the wrapper function by
>   string filename = args(1).string_value ();
> but I can't find a way to convert the string to a char array (char[30]) in
> order to pass the argument to the C function.  If this is really quite

Hi Ryan,

What you need is the C++ string class member function c_str(). The
conversion should go like this: 

string tmp = args(1).string_value();
char *filename = tmp.c_str();

I've found this online reference to be quite handy when working with C++:



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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