Path: utzoo!utgpu!watserv1!watdragon!lion!mefarimani From: mefarimani@lion.waterloo.edu (Mehran E. Farimani) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: Turbo C File Size Routines: Message-ID: <23059@watdragon.waterloo.edu> Date: 9 Apr 90 20:26:27 GMT References: <3263@bingvaxu.cc.binghamton.edu> <26201F3B.1118@maccs.dcss.mcmaster.ca> Sender: daemon@watdragon.waterloo.edu Organization: University of Waterloo Lines: 20 In article <26201F3B.1118@maccs.dcss.mcmaster.ca> cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) writes: > > 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 > ............... There are routines in both TC and MSC that do a file spec search (with pattern matching) in a directory. I think the names are something like "findfirst" and "findnext" for TC and "_dos_find_first" and "_dos_find_next" for MSC. These routines merely use an INT 21 service. Anyhow, every filename that matches the spec gets most of its directory info such as file size and date put into a structure. So you can check the appropriate fields for whatever purpose you need. This is also much more efficient that "fopen"ing a file, "fseek"ing to the end, "ftell"ing the position, and then "fclose"ing it. Mehran