Hello,
I have a file where the data layout is known. Suppose it's like this:
image1
SomeData
...
image1000
SomeData
...
I want to get an access to the line I want without the necessity to move across all the lines. Let's say I wanna access directly to the line "image627", is that possible?
void ReadFile( const char* file, uint32 image )
{
char line[255], temp [64];
while (fgets(line, sizeof line, file) != NULL) // read the file line by line
{
sprintf(temp, "image%u", image);
if ( (strncmp(line, temp, 6) == 0) || (strncmp(line, temp, 7) == 0) || (strncmp(line, temp, 8) == 0) )
{
// do something
}
}
}
Thank you!