Return a string via MSVC (Purebasic 4.00)
Posted: Thu Jul 06, 2006 10:42 am
In Purebasic 3.94, I use the following code to return a string :-
In Purebasic 4.00, this code crashes the compiler ... can someone show me how to correctly return strings in pb 4.00?
Thanks.
Code: Select all
#include <windows>
#include <stdio>
extern "C"
{
extern char *PB_StringBase;
extern char *PB_Getit()
{
char *ResultString = PB_StringBase;
int StringLength = strlen("HelloWorld!");
strcpy(PB_StringBase, "HelloWorld!");
PB_StringBase += StringLength;
*PB_StringBase = 0;
return ResultString;
}
}
Thanks.