When I run the program containing this code, it crashes immediately as it calls CmdHandler. Ive spent a reasonable amount of time trying to figure out whats wrong... but I honestly dont know. Any ideas?
for(int i = 0; i < MAX_NUM_PLAYERS; i++)
{
if((n = read(Paveria->Players.Sock, Paveria->Players.LastCmd, MAX_INPUT_LENGTH)) > 0)
{
write(Paveria->Players.Sock, "Reading...\n", 11);
CmdHandler(Paveria->Players);
}
}
void CmdHandler(Player Ch)
{
switch(Ch.State)
{
/* Waiting for user ID */
case STATE_NAME:
break;
default:
write(Ch.Sock, "Error! Invalid State!\n", 22);
}
};
[Edited by - nethackpro on December 22, 2008 10:53:37 PM]