C BMax value passing

BlitzMax Forums/BlitzMax Programming/C BMax value passing

I have a C file with a char ptr var:
static char *abc;

How could i read it with BMax and print it?

I've tryied

import "file.c"

extern
global abc:string ptr
end extern

print abc



But it says that is impossible to convert from string ptr to string.

try $z or Byte Ptr instead of String Ptr

it says:
unable to convert from byte ptr to string.

i have to receive this var from a c file, and then write it to a file.

Use FromCString() like this...

Test.bmx
Import "test.c"

Extern
    Function GetABC:Byte Ptr()
End Extern

Print String.FromCString(GetABC())

test.c
char* abc = "Hello World";

char* GetABC(void)
{
    return abc;
}



YES, IT WORKS!!!!
THANKS Stuart Morgan.

With this problem solved, my Linux Webcam Module is almost finished.

I have to thank you very much.

I'll put your nick into my credits.

I think i'll release the module one of these days.

:)

i don't know where the problem is:
it aquires all the image somethimes, and a few bytes or kbytes other times.

writing data using writestring or writeline writes data as ascii.
i need to print them as int.
i'll try writeint.

however sometimes it works and sometimes not.

if anyone has suggests, please post.

Do you read them again with readInt and not readByte or something similar?

I need to write them.

However i've changed it to writestring and it now works perfectly!

!!!

:)