dbRight returns corrupted char string????
2 posters
:: DarkGDK :: DarkGDK Help
Page 1 of 1
dbRight returns corrupted char string????
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;
}
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 : 72
Location : Netherlands
sdfc
this is what i see
char = character and can only hold a single character if it holds more than 1 character than its a string.
char* one = ".scl";
char* two = "testfile.scl";
char* three = dbRight(two,4);
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 "" ).
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");
}
c++noob- Posts : 7
Join date : 2011-07-24
:: DarkGDK :: DarkGDK Help
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum