Question: I have a file stream in C and I want to know how many lines are in it without iterating through the file. Each line is the same length. How might I go about this?

Answer: 
If it is safe to assume that all lines are of equal length, you can simply read in the first line, get its length, then get the file size, and divide file size by line length.

This will only work with fixed-width encodings (ASCII-7, the various 8-bit ANSI encodings, UTF-32); with variable-width encodings (e.g. UTF-8), you will have to scan the entire file, because string length is not necessarily proportional to the number of bytes.
Read one line, `stat()` the file to [get the total size](https://stackoverflow.com/questions/238603/how-can-i-get-a-files-size-in-c), divide the total size by the length of the first line.

Instead of using `stat()` you could also `fseek()` to the end of the file and then use `ftell()` to get the size.