i changed some stuffs but the thing is..its doesnt get the other item, its only gets the first one, i tried putting it into an array but its still doesnt work, i even tried a do while loop. should i increment the item for it to move and check the other one??
Code:
void handleCommand(const char *c,char board[][100])
{
char item;
char direction;
int distance;
int x = 0, y = 0;
/* analyse for dw3 etc */
sscanf(c,"%c%c%d",&item,&direction,&distance);
initscr();
while(item == 'd') {
if (direction == 'e') {
mvaddch(distance,0,DOOR);
}
if (direction == 'n') {
mvaddch(0,distance,DOOR);
}
getch();
endwin();
}
}
int main()
{
char board[100][100];
initscr();
FILE *pFile;
char command[10];
pFile = fopen("room.txt", "r");
if (pFile == NULL)
perror("Error opening file");
else {
while (fscanf(pFile, "%s", command) == 1) {
handleCommand(command,board);
}
}
fclose(pFile);
return 0;
}