On Wed, 3 Aug 2011, simon rupar wrote:
I'm trying to make some C# sample to connect to Libgretl. The
sample seems
to work ok, until I call gretl_read_native_data (oh, by the way I am using
sample tat is on
http://gretl.sourceforge.net/API/gretl-Data-I-O.html). I
always get int 12, which by Gretl error refrence means I put the wrong
filename. Here is sample code:
gretl.DATAINFO pddata =
(gretl.DATAINFO)Marshal.PtrToStructure(p, typeof(gretl.DATAINFO));
string fname = @"D:\izhod.gdt";
StringBuilder test = new StringBuilder(fname);
double Z = 0;
int err = gretl.gretl_read_native_data(test, ref Z, ref
pddata);
First of all, I'm totally unfamiliar with C#, so this may not be
relevant, but... If the name of the file to be opened were
interpreted as a regular C string, then either (a) the backslash
should be doubled ("\\") since '\' is an escape character in C, or
(b) it should be substituted by a forward slash '/', which is OK so
far as Windows' cmd.exe is concerned.
Allin Cottrell