[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Passing a string to an external function
From: |
Ryan Shepperd |
Subject: |
Passing a string to an external function |
Date: |
Fri, 5 May 2000 17:24:59 +0900 (JST) |
Dear Community
I'm not a C++ programmer but I managed to write most of a wrapper function
for an external C program, which I need to call from Octave. The C
function expects arguments of type "float" and "char." I've successfully
passed the C-function its float arguments by first using a type cast in
the following manner:
ColumnVector x = args(0).vector_value ();
some_float_var = (float) x(0);
This works great. 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
trivial, I apologize for wasting bandwidth; however, I have done my best
grep through the help archive and example wrapper functions. :)
If someone more knowledgeable could tell me how to type cast from
"string" to a "char," I would be grateful.
THANKS
Ryan Shepperd
address@hidden
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------
- Passing a string to an external function,
Ryan Shepperd <=