CompuServe Thread

#DiskReads & Size?

3 messages in this thread
#39264From: New memberFeb 2, 1994 5:49 PM
Another AmigaDos question. I am porting over the part of the program that reads in a disk file into a 16K buffer. I understand that I can set my block size to 16K and just keep reading. Question is how do I get the files total size? I guess I could keep doing reads until I get back less then my requested block size but it would be nice to be able to say (early on) Sorry this file is too large to load in. Thanks.
#39290From: Jim ButterfieldFeb 3, 1994 5:37 PM
There are quite a few ways of finding the size of a file. Traditional method: get a lock on the file, set aside an InfoData area, and then call Info(lock,info_Data). You can read file size in bytes OR in blocks from the FileInfoBlock. Don't forget to release the lock when you're done. Anothe way, when the file has been opened, is to use the Seek(handle, position, mode) call. Since mode permits OFFSET_BEGINNING, OFFSET_CURRENT, and OFFSET_END, and the Seek function returns "oldPosition", it's not hard to work out the sequence to get a file length. –Jim
#39387From: New memberFeb 8, 1994 11:58 AM
Ok Jim, Thanks much for your reply. I will make my conversion a lot "cleaner" Best to you and yours.