I would like to know if there is a method for reading characters from a file and saving them into an array without a specified array length.
In normal situation I read all the characters and count them. (step 1) Then I create the array with malloc and read the characters from the file, so I am forced to read the whole file twice. Can it be done with only one reading?
The normal way to do this is to do a fseek to end of file, then you are not actually reading all the characters twice.