RE: Strcmp() problem stepping through AVR Studio (Never Mind)
2005-04-11 by wbounce
Never mind dumb typo on my part. I had a ; after the ) of the if on the ones that did the assignment. I should have looked at the disassembler earlier
Show quoted textHide quoted text
-----Original Message-----
From: wbounce [mailto:wbounce@safeplace.net]
Sent: Sunday, April 10, 2005 10:51 PM
To: 'AVR-Chat@yahoogroups.com'
Subject: Strcmp() problem stepping through AVR Studio
If have serveral strcmp statements
Originally I had them all like this.
if (strcmp("GPGGA",gcBuffer) == 0)
{
gpFieldPtr=(PGM_P) GGA;
}
It would execute the pointer assignment on each of the 8 statements
I changed them to
lnResult = strcmp("GPGLL",gcBuffer);
if (lnResult == 0)
{
gpFieldPtr=GLL;
}
So I could see the result code of strcmp. This time it skipped the 1st 3
ok but then started doing the assignments. And when it got to the strcmp
that should have matched, lnResult was not 0 and yet it did the
assignment anyhow.
Anyone have any idea why?