void test() { char s[] = "54 2 5654 1 234 0 23423 1 2323"; char *p = s, *q = s, tmp; int nr = 0, state = 0; int spellId, effIndex; while(1) { while(1) { if(!*p) { printf("Creature has wrong aura defined.\n"); return; } else if(*p == ' ') { tmp = *p; *p = 0; spellId = atoi(q); *p = tmp; p++; q = p; break; } else p++; } while(1) { if(!*p) { effIndex = atoi(q); printf("%d %d\n", spellId, effIndex); return; } else if(*p == ' ') { tmp = *p; *p = 0; effIndex = atoi(q); printf("%d %d\n", spellId, effIndex); *p = tmp; p++; q = p; break; } else p++; } } }