Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!vsi1!octopus!stever From: stever@Octopus.COM (Steve Resnick ) Newsgroups: comp.os.msdos.programmer Subject: Re: ?? Size of running Turbo C program ?? Keywords: Turbo C, program size, runtime Message-ID: <1990Nov29.162646.10584@Octopus.COM> Date: 29 Nov 90 16:26:46 GMT References: <1990Nov28.141911.18547@cec1.wustl.edu> <75004@iuvax.cs.indiana.edu> Reply-To: stever@octopus.UUCP (Steve Resnick ) Distribution: usa Organization: Octopus Enterprises, Cupertino CA Lines: 30 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: >> [stuff deleted] >> 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. There are some documented and undocumented internal variables, such as _heapbase, _heaplen, etc, which may point you in the right direction. You may also want to consider using the keep() function which calls DOS function 31 to TSR >64K .... Hope this helps ... Steve -- ---------------------------------------------------------------------------- steve.resnick@f105.n143.z1.FIDONET.ORG - or - apple!camphq!105!steve.resnick Flames, grammar errors, spelling errrors >/dev/nul The Asylum OS/2 BBS - (408)263-8017 IFNA 1:143/105.0