LANS
unread,Dec 7, 2008, 9:53:31 PM12/7/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Xsera Development
#include <iostream>
#include <stdio.h>
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[i] == 95) )
{
}
else
{
goodMessage = false;
break;
}
}
if(goodMessage == true)
std::cout<< "true";
else {
std::cout << "false";
}
return 0;
}
Anyways, if I add a bad character into that, it succesfully spits out
"false". If there are no bad characters, it segfaults. I can't figure
it out right now, but it has something to do with the last two terms
of the array (its fine up through i=62 for a 63-length array). When I
run it through GDB with a breakpoint on the loop, it says
"EXEC_BAD_ACCESS". When I run it straight, it says "Error 10
(SIGGBUS)". Any help would be appreciated.
Thanks,
Andrew