Artie Gold wrote:
> Dan wrote:
>> FILE *file;
>> char temp[10];
>> file = fopen("filelist.txt", "r");
>> int i = 0;
>
> In C89, which your compiler most likely implements, all declarations
> must be at the beginning of a block; C99 (and C++) do not have that
> restriction[1].
>
> You could, for example, move the declaration of `i' above the call to
> fopen().
Or you could make a new, unnamed, segment with a new scope, which will cause
i to be a temporary variable available only to that segment:
file = fopen(szFileName, "r");
{
int i = 0;
// the rest of the segment here
}
--
Martijn Haak
http://www.serenceconcepts.nl