Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mit-eddie.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!lenoil From: lenoil@mit-eddie.UUCP (Robert Scott Lenoil) Newsgroups: net.micro.cbm Subject: Re: A 1541 DOS question Message-ID: <3240@mit-eddie.UUCP> Date: Tue, 4-Dec-84 16:21:29 EST Article-I.D.: mit-eddi.3240 Posted: Tue Dec 4 16:21:29 1984 Date-Received: Wed, 5-Dec-84 01:30:21 EST References: <1052@drufl.UUCP> Organization: MIT, Cambridge, MA Lines: 19 >A directory entry for a file only contains the number of blocks. >How can you tell how long (in bytes) a file is ? Does the DOS >keep this information somewhere ? does file type matter? No, the Commodore DOS does not maintain a record of a file's size, beyond the number of blocks. Usually, this is sufficient, as you just multiply this number by 254, the number of bytes in a block minus the two byte pointer to the next block in the file. If you want to get an exact count, probably the easiest way would be to open the file for read, and read it in byte by byte, counting as you go. Otherwise, you'd have to chain through the file blocks on the disk to get at the last block (the only one that may have less than 254 bytes in it). I don't remember for sure how they mark the last byte in this block, but it's probably by the sector byte of the next-block pointer (the track byte will be zero, signalling the last block of the chain). Robert Lenoil USENET: {ihnp4,decvax!genrad,godot,harvard}!mit-eddie!lenoil ARPANET: lenoil@mit-xx.arpa