Was just wondering if there is anything that exists to retrieve a certain amount of lines from a file or should I just go ahead & make an array of it with file & then loop through it until I get the required data?
All I’m trying to do is get the first 11 lines of data from a file (or less if there aren’t 11).
For such a small amount of lines, I’d recommend
fopen(). This way for big files you haven’t read in the whole thing.Example:
Read more about fgets()