Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi There,
I'm having a little problem with my code. What I'm developing is a tourist information guide for a palm pilot. Ok, here's the code. I've declared a struct in my .h file.
typedef struct
{
char Category_choice[20];
} ChoiceDB;In my .c file I'm storing a string from a list into the struct and saving it in memory.
//global variables in the .c file
MemHandle Mem_Handle, ShopsHandle;
char *Amenity;
ChoiceDB *choice_record;This code below is in a function which gets the string from the list, saves it in the struct and then goes to another form. The code for this form is in the same .c file.
AmenityList = GetObjectPtr(AmenitiesShopsList);
Amenity = LstGetSelectionText(AmenityList, LstGetSelection(AmenityList));// Allocate memory for a structure
Mem_Handle = MemHandleNew(sizeof(ChoiceDB));
choice_record = MemHandleLock(Mem_Handle);
StrCopy(choice_record->Category_choice, Amenity);
MemHandleUnlock(Mem_Handle);
FrmGotoForm(AmenitiesDetailsForm);The code below is executed when the AmenitiesDetailsForm is opened.
char amenity_choice[20];
choice_record = MemHandleLock(Mem_Handle);
StrCopy(amenity_choice, choice_record->Category_choice);
MemHandleUnlock(Mem_Handle);
MemHandleFree(Mem_Handle);if(amenity_choice=="Pub")
{
WinDrawChars("Woop-di-do", StrLen("Woop-di-do"), 80,90);
}This string that I'm getting from the list is called "Pub". I'm able to get the length of the string and it comes up as 3 so the string is correct. But the problem is, is that the if statement isn't working. It doesn't seem to recognise the string "Pub" which is coming from the list in the other form. Is the problem with the array amenity_choice and using an if statement with it. This is the only thing that's stopping me at the moment.
Any help would be greatly appreciated.
Thanks,
Shane Fleming

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |