algorithm problem

Hey guys Im having a probelm with my algorithm . Im trying to copy data from a asci ppm file(which is just a text file really) into a 2-d array of structs. The order it should go in is plot[1][1],plot[1][2].....plot[2][1]..and so on.
Here is the code

Im not getting the currect output when I run the program. My results are 251,255,254. It should be 255,255,254. I think I have a problem with the nested for loops. If you would to see more code. Like the function call, I will post it.