Welcome to the forum

register! and help us get started! with this new darkgdk forum !


dont forget to introduce yourself Razz

enjoy! and good luck with your programming Smile


dbRight returns corrupted char string????

Go down

dbRight returns corrupted char string????

Post  kilroy007 on Sat Aug 06, 2011 10:54 am

Hello, i'm new here.
Can anyone tell me why char* one is unequal to char * three?

On my computer it turns out that "Three's greater than one"
should be equal.


#include "DarkGDK.h"

// the main entry point for the application is this function
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
char* one = ".scl";
char* two = "testfile.scl";
char* three = dbRight(two,4);
dbPrint(one);
dbPrint(three);
if (three > one)
{
dbPrint("Three's greater than one");
}
else
if (three < one)
{
dbPrint("Three's smaller than one");
}
else
{
dbPrint("Three's equal to one");
}
while ( LoopGDK ( ) )
{
dbSync ( );
}
return;
}

kilroy007

Posts : 1
Join date : 2011-08-06
Age : 66
Location : Netherlands

View user profile

Back to top Go down

sdfc

Post  c++noob on Fri Aug 19, 2011 1:50 pm

this is what i see

char* one = ".scl";
char* two = "testfile.scl";
char* three = dbRight(two,4);
char = character and can only hold a single character if it holds more than 1 character than its a string.

dbPrint(one);
dbPrint(three);
if (three > one)
{
dbPrint("Three's greater than one");
}
else
if (three < one)
{
dbPrint("Three's smaller than one");
}
else
{
dbPrint("Three's equal to one");
}
you didnt declare a variable ""three" or "one" if your just using numbers you need to use a number not text because your compiler reads numbers as numbers and text as a variable name ( unless in "" ).

c++noob

Posts : 7
Join date : 2011-07-24

View user profile

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum