C read file line by line

If your task is not to invent the line-by-line reading function, but just to read the file line-by-line, you may use a typical code snippet involving the getline() function (see the manual page here):

C read file line by line

I wrote this function to read a line from a file: The function reads the file correctly, and using printf I see that the constLine string did get read correctly as well. However, if I use the function e.g. like this: printf outputs gibberish. Why?

C read file line by line

I wrote this function to read a line from a file: The function reads the file correctly, and using printf I see that the constLine string did get read correctly as well. However, if I use the function e.g. like this: printf outputs gibberish. Why?