rotovegasBoy
Programmer
I've written two programs to simulate a transaction lookaside buffer in a sparc 4 (any sort of processor uses the same concepts the just don't call it a t.l.b. The programs get from a pipe a stack trace and simulate vairous replacement algorithms. The first program works fine. The second has a small (weel kinda big) bug it will slip into an infinite loop. If I pipe the output through the unix "head" command it doesnt enter the infinite loop.<br>I'm using the command<br><br>while(fscanf(stdin, "%d %x", &i, &v)==2){<br>//stuff here<br>}<br><br>in both programs i can't quite see why one is looping infinitely and one is not. the diference between the two is that the second reads ahead and puts the v hex number into an array, when the array is full it simulates a best case scenario with the array. Any idea why this is looping without the use of "head"?