Path: utzoo!attcan!lsuc!maccs!cs4g6ag From: cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: Turbo C File Size Routines: Message-ID: <26201F3B.1118@maccs.dcss.mcmaster.ca> Date: 9 Apr 90 05:35:55 GMT References: <3263@bingvaxu.cc.binghamton.edu> Organization: McMaster University, Hamilton, Ontario Lines: 27 Well, I don't know if TC provides a function to determine the length of the file, but you can certainly use ftell() to find your current position and something similar to the following to determine the length of the file if it doesn't (and the following should be portable to all C compilers - it will certainly work on anything that accepts ANSI C). #include long filelength (FILE *fp) { long current_position = ftell (fp); long length_of_file; fseek (fp, 0, SEEK_END); length_of_file = ftell (fp); fseek (fp, current_position, SEEK_SET); return length_of_file; } Please excuse any typos ... -- More half-baked ideas from the oven of: **************************************************************************** Stephen M. Dunn cs4g6ag@maccs.dcss.mcmaster.ca = "\nI'm only an undergraduate ... for now!\n";