News

To read from a text file in C, you will need to open a file stream using the fopen () function. Once a file stream has been opened, you can then read the file line by line using the fgets () function.
You could copy the whole file into an array of characters (bytes) if you wanted, though as mentioned, it might be silly. However, many times, the silly solution is plenty good enough for academic ...
This works great if the JSON file it reads contains an array (2+ items) and correctly appends the new item. However if this tries to read a file with a single item in it, it blows up with this: ...