请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430FR2355 您好...
我通过 UART 接收字符...我将字符填充到数组中... x 个数字后,我想将这些字符与字符串文字进行比较...不确定如何正确执行...我正在获取我的传入数组并添加'\0',然后尝试使用 strcpy 进行比较...编译器不喜欢我 执行此操作。 具有 C 语言技能的人能否解释我做了什么错???
static char NMEA[30], NMEAstring[5]; //only visible to gps.c
uint8_t GPSMssgParser(gpsMssg_s *p)
{
uint8_t err = 0;
static uint8_t i = 0;
NMEA[i] = p->gps.pSysCommsA->UCAxRXBUF;
i++;
if (i == 5)
{
NMEA[6] = '\0';
strncpy(NMEAstring[0], NMEA[0], 6);
}
if (NMEAString[0] == "$GNRMC")
{
P1OUT ^= BIT0;
}
return err;
}
警告和错误
"../driver/source/gps.c", line 35: warning #169-D: argument of type "char" is incompatible with parameter of type "char *__restrict__" "../driver/source/gps.c", line 35: warning #169-D: argument of type "char" is incompatible with parameter of type "const char *__restrict__" "../driver/source/gps.c", line 38: error #20: identifier "NMEAString" is undefined
谢谢