Need help opening a series of files

So I'm writing a function in my program which will, among other things, open a bunch of files and read data from them through a for loop. The file names are in the format "Lightcurves\modelB.##.mag" where ## refers to i, the variable I'm looping through, which goes from 0 to 90 in steps of 5.

Before I put in the loop with the fscanf, it worked fine and said it opened all the files properly, now it crashes when I run it. I'm not quite sure how to read the data now because that hasn't ever happened to me before.

After a bit of help with a particular problem in another thread, I've got this now:

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

haha...not quite my first post, glad you like the name, and thanks for the code help

I wasn't talking about you, but rather the other poster. With the first post and the funny name. [edit] &#167;&#225;&#223;&#248;†&#230;™ [/edit]

dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell