kklouzal you should learn about C strings and pointers before trying to use them. You can't use them in the same way as standard or DBP strings.
I suggest reading the tutorials here and practising, you will eventually understand:
http://www.cplusplus.com/doc/tutorial/
Quote: "The other problem is that I can't use strcmp because it would require a const pointer and dbEntry return value is not constant."
You can use strcmp fine, without type casting.
Quote: "I tested this dbGetEntry and the problem seems to be that after the first test, the returned pointer is always non-zero, even if the string is empty."
When I tested it, it initially returned NULL.
Quote: "P.S. In any case, storing the pointer that dbGetEntry returns and then trying to delete that is a bad idea, since this is a system-managed string that you are not supposed to delete. The dbCearEntryBuffer function in the above example will empty the input string after reading the next character."
Actually the string returned by dbGetEntry (and so far as I know, all other DGDK commands) is not internal memory, it is allocated purely for the purpose of the return string so you need to deallocate it with delete[] to avoid a memory leak.
Here is some sample code, which also shows the pointer address. If you remove delete[] the pointer address changes with every dbGetEntry, which suggests that it is not constant internal memory and so needs to be deallocated:
#include <DarkGDK.h>
using namespace std;
void DarkGDK(void)
{
char * blank = "";
char curtxt[1024] = { '\0' };
// Main loop
while(LoopGDK() == true)
{
dbWait(1);
// Get entry
char * de = dbGetEntry();
// If de is not empty
if(de != NULL)
{
int result = strcmp(de,blank);
if(result != 0)
{
// Append to curtxt (note: will eventually run out of memory)
strcat( curtxt, de );
// Display de
dbPrint(de);
// Display pointer to de
dbPrint((LONGLONG)de);
// New line
dbPrint();
// Clear entry buffer
dbClearEntryBuffer();
}
// Deallocate memory
delete[] de;
}
}
}