>>105571859
For someone supposedly so intelligent, you sure ignored the option of not using fgets and using something that makes finding the total string length in bytes trivial.