Another C string passing question
BlitzMax Forums/BlitzMax Programming/Another C string passing question
| ||
I have to pass a string to a C file from a bmax one. On the file there is: char s[80]; void func(?) { ... } and on the bmax file i need to write: import "file.c" extern function func(?) end extern func("string") What should i write on the places i've marked with a "?" ? |
| ||
Sorry - double post |
| ||
void func ( char *cString ) and function func ( chars:byte ptr ) and then call it by: func ( "string".tocstring () ) - Should work, |
| ||
But after called the func function i have to do: char s[80]; func(string) s=string and with this method isn't possible(i work char, not char *). |
| ||
You could use strcpy, ie: strcpy ( &s, cString ); I think you would need to change the function decleration to: func ( const char *cString ) http://www.cplusplus.com/ref/cstring/strcpy.html |
| ||
Now i can't, but i'll try it as soon as possible. thanks for your help. |