I am trying to write some code that will open a file, read its content line by line and store each of these lines into an array.
First I open the file and count the
fopen()
, fgets()
and fclose()
to do the I/O. You're using much lower-level Posix-style I/O, for no good reason.strdup()
to do this.