messageID checking issues

0 views
Skip to first unread message

LANS

unread,
Dec 6, 2008, 12:02:14 PM12/6/08
to Xsera Development
So, I've started adding code to check if messageID contains A-Z, a-z,
0-9, and _, and dump the message if it doesn't contain only those.

I've tried to test what I wrote using this in a separate, standalone
program, but I keep getting an error:
"ISO C++ forbids comparison between pointer and integer"
Any help would be appreciated.



int main () {
int messageIDLength = 63;
char messageID[63] = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a',
'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
int i;
bool goodMessage = true;
for(i = 0; i <= messageIDLength; i++)
{//......................
0........9....||...................A........Z....||...................a.........z....||................
_

if( (messageID[i] >= 48 && messageID[i]<= 57) || (messageID[i] >=
65 && messageID[i] <= 90) || (messageID[i] >= 97 && messageID[i] <=
122) || (messageID == 95) )
{
}
else
{
goodMessage = false;
break;
}

}

}

Alastair Lynn

unread,
Dec 6, 2008, 12:04:30 PM12/6/08
to xser...@googlegroups.com
Hi Andrew-

In the line: messageID == 95
It should be: messageID[i] == 95

And make sure you return a value from main.

> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "Xsera Development" group.
> To post to this group, send email to xser...@googlegroups.com
> To unsubscribe from this group, send email to xsera-dev+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/xsera-dev?hl=en
> -~----------~----~----~----~------~----~------~--~---
>

LANS

unread,
Dec 6, 2008, 9:52:30 PM12/6/08
to Xsera Development
Thanks, that worked. Now I've just got to fiddle with it until it
clears all allowed characters, but fails when a bad character is
passed. Its not quite working yet. It gives me SIGBUS errors, but I'm
tired and going to bed. I'll fix it tomorrow when I'm more awake.
>  smime.p7s
> 5KViewDownload
Reply all
Reply to author
Forward
0 new messages