getline() and fgets() give Segmentation Fault

Hi all,

I'm writing a program to read from a stream file, one line at a time,
I used getline() and fgets(), both gives a correct result,
but they give a "segmentation fault" when reading the last line of the file, I think because of the NULL character at the end of the file.
do they supposed to give such an error when reading a NULL character?
and what are other alternatives that could work for my code?
I'm using Ubuntu,

thanks in advance,
No, they shouldn't. Can I see the code?
Topic archived. No new replies allowed.