Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!uflorida!rex!wuarchive!udel!rochester!pt.cs.cmu.edu!b.gp.cs.cmu.edu!ralf From: ralf@b.gp.cs.cmu.edu (Ralf Brown) Newsgroups: comp.os.msdos.programmer Subject: Re: ?? Size of running Turbo C program ?? Keywords: Turbo C, program size, runtime Message-ID: <11242@pt.cs.cmu.edu> Date: 30 Nov 90 00:31:42 GMT References: <1990Nov28.141911.18547@cec1.wustl.edu> <75004@iuvax.cs.indiana.edu> <1990Nov29.162646.10584@Octopus.COM> Distribution: usa Organization: Carnegie-Mellon University, CS/RI Lines: 25 In article <1990Nov29.162646.10584@Octopus.COM> stever@octopus.UUCP (Steve Resnick ) writes: }In article <75004@iuvax.cs.indiana.edu> hughes@copper.ucs.indiana.edu (larry hughes) writes: }>In article <1990Nov28.141911.18547@cec1.wustl.edu> jma7759@cec2.wustl.edu (James Michael Anderson) writes: }>> One possiblity is for me to compile my program and then use the }>>file size as a hardcoded value; however, there has got to be a "slicker" }>>way to do this. Any suggesions? }> }>One way is to have the executable open() itself, and then use filelength(). } }Bzzz. Nope, sorry, wrong answer. This will work on a .COM file only. }In any other memory model, ie, one which creates a .EXE file, there can }be uninitialized data such as empty arrays, etc which are defined in size }but not stored in the .EXE file. I don't know a sure-fire way to determine }the size of a program, but filelength on an EXE will almost always be wrong. It will also be wrong on .COMs, since uninitialized variables aren't stored in the executable in Tiny model, either (nor is the stack). TLINK has a switch to initialize all segments, in which case all that uninitialized data will be stored in the executable (either .COM or .EXE) as zeros. -- {backbone}!cs.cmu.edu!ralf ARPA: RALF@CS.CMU.EDU FIDO: Ralf Brown 1:129/3.1 BITnet: RALF%CS.CMU.EDU@CMUCCVMA AT&Tnet: (412)268-3053 (school) FAX: ask DISCLAIMER? Did | Everything is funny as long as it is happening to I claim something?| someone else. --Will Rogers