in reply to combining multiple files into one file

A few additional remarks:
* readdir gives you all the 'files' in the directory, including ., .., directories etc.. You should filter out the file you want.
* Why not use a simple cat *.htm >all.htm ? You get the same useless file with less effort...

Paul