Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8013

Other programming languages • Re: Basic on Raspberry

$
0
0
not really a "shortcoming" because C has other methods of storing and manipulating binary data, for example a memory block allocated with malloc().
Memory allocation functions are available in BASIC.
ALLOCATE in FreeBasic.
AllocateMemory and AllocateStructure in PureBasic.
Me somehow managed to call malloc() from code PureBasic. :shock:

Code:

Import ""  malloc(size)EndImportDebug malloc(100) ; Allocate 100 bytes from memory.
I don't understand how it works, but the function is called and returns a number. :)
If you want a pointer to that string (which you may if you want to pass it to an API function, for example) you do that as follows:
For some unknown reason it doesn't work.

Code:

      SYS "MessageBoxA" 0, PTR("Text"), PTR("Title"), 0      REM SYS "MessageBoxW" 0, PTR("Text"), PTR("Title"), 0      REM SYS "MessageBoxA" 0, "Text", "Title", 0      REM SYS "MessageBoxW" 0, "Text", "Title", 0
What is my mistake?

Statistics: Posted by Vasian — Wed Apr 02, 2025 4:12 pm



Viewing all articles
Browse latest Browse all 8013

Trending Articles