Pascal Ehlert said:
The data which was read out by fread.. I don't know how to call it.
OK, I think you're reading from a file which was opened in
'binary mode', i.e. 'fopen()'s second argument of "rb", and
passign 'fread()' an pointer to your array
Yes, that's what I want.. Like strcat does it.
Well you can't do it 'like strcat() does it' (unless you can
guarantee your file does not contain any characters with value
zero).
If you can make this guarantee:
Before you open the file, set the array element where you
want to start appending to zero. Then before each read,
search for that zero, pass its address to fread(), after
fread is done, set the array element after the read data
to zero. Keep doing this until you have all the data you
want, or end of file.
But all that isn't necessary. fread() will tell you (via
its return value) how many items were read (in the case
of characters, this is the same thing as bytes -- see
fread documentation for further details.) You can use this
information to specify the address (i.e. fread's first argument)
for subsequent calls to fread.
Finally remember to ensure that your array is large enough
to accomodate all the desired data.
-Mike