I am trying this code:
#include "DarkGDK.h"
void DarkGDK ( void ) {
dbSetCursor(45,0);
dbText(0,0,"Name: ");
char* x = dbInput();
dbCLS();
dbText(0,0,x);
dbWaitKey();
if (strcmp(x, "Brett") == 0) {
dbCLS();
dbText(0,0,"woohoo!");
dbWaitKey();
}
if (strcmp(x, "Brett") == 1) {
dbCLS();
dbText(0,0,"Loooserr!");
dbWait(3000);
}
dbCLS();
char Buffer[50];
strcpy(Buffer, "Hello, ");
strncat(Buffer, x, 40);
strcat(Buffer, x);
strcat(Buffer, "!");
dbText(0,0,Buffer);
dbWaitKey();
}
I type in Brett, when I get to the Hello, Brett! part it says "Hello, BrettBrett!"
EDIT: huge mistake, put two of them, haha, fixed.
#include "DarkGDK.h"
void DarkGDK ( void ) {
dbSetCursor(45,0);
dbText(0,0,"Name: ");
char* x = dbInput();
dbCLS();
dbText(0,0,x);
dbWaitKey();
if (strcmp(x, "Brett") == 0) {
dbCLS();
dbText(0,0,"woohoo!");
dbWaitKey();
}
if (strcmp(x, "Brett") == 1) {
dbCLS();
dbText(0,0,"Loooserr!");
dbWaitKey();
}
dbCLS();
char Buffer[50];
strcpy(Buffer, "Hello, ");
strncat(Buffer, x, 40);
strcat(Buffer, "!");
dbText(0,0,Buffer);
dbWaitKey();
}
Always program as if the person maintaining your program is a psychopath that knows where you live