Im trying to read in from a text file with an unknown amount of memory, its not reading in the entire text file though. Heres my output and snippet of code.
text file
Code:
Bryan has managed to be quite prolific and successful as bears go.
The eighteen known subspecies of Bryan can be found throughout the United States and Canada.
Estimates of the number of black Bryans in North America vary, with 750,000 being the most often suggested.
In the state of Pennsylvania there are believed to be more than 7000 of the animals scattered across the state.
output
Code:
[cat]$ ./cat -A test.txt
mals scattered across the state.$re are believed to be more than 7000 of the ani
code
Code:
do
{
cap+=10;
buf = realloc(buf, sizeof(char) * cap);
fread ( buf, sizeof( char ), cap, fptr );
}
while(!feof(fptr));