Trying to figure out how to read my dictionary using fgetc. I was going to implement the reading using fgetc inside of a while loop. However, after peeking at example code on here, I see along of implementations using fgetc actually within a for loop.

My question is, is it wrong or harder to implement it inside a while loop?

1 Answer 1


It definitely won't be wrong if it loads the words (and I've seen several implementations with fgetc() that work just as good).

How hard it is? That will depend on you. For me, it is easier to think about reading line by line with fgets(). However, I have in my mind that the last piece of the word is {..., '\n', '\0'}, so it includes a new line. But I've met people that they rather see the code reading character by character with fgetc() and checking with code for '\n' (new line) themselves.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .