Originally Posted By: Hredot
does free(str); only free up memory up to the null character, which could potentially lead to a memory leak?
No. You can use malloc and free for any kind of data, not just char arrays.
Quote:
Isn't loading the entire file just to read one line a bit excessive? Perhaps some ideas presented here could help ease the workload.
I was trying to help you solve your problem in five minutes or less. You're writing in C... why do you care about these optimizations? Are you reading gigabytes of data?