31
GLBasic - en / Re: Save a TYPE array object
« on: 2022-May-05 »
The information is there. See the gpc_temp.h file. Each type has a dbg() function. In what format would you want to store the data? Consider you also have arrays.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
LOCAL mem$ = "Hello World"
LOCAL memlen = LEN(mem$)
LOCAL file$ = MemMakeFile$(mem$)
LOCAL text$
OPENFILE(1, file$, TRUE)
READSTR 1, text$, 64
CLOSEFILE 1
STDOUT text$ + "\n"
KEYWAIT
FUNCTION foo:
ENDFUNCTION
INLINE
extern "C" {int sprintf(char *str, const char *format, ...); }
ENDINLINE
FUNCTION MemMakeFile$: BYREF data$, nofBytes = -1
IF nofBytes < 0 THEN nofBytes = LEN(data$)
LOCAL url$
LOCAL hx$ = RIGHT$("0000000000000000" + HEX$(nofBytes), 8)
INLINE
void* address = &data_Str[0];
char buffer[64];
sprintf(buffer, "%x", address);
url_Str = CGStr("mem://") + hx_Str + CGStr(".") + CGStr(buffer);
ENDINLINE
RETURN url$
ENDFUNCTION