Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!psuvax1!psuvm!blekul11!gutest8 From: GUTEST8@cc1.kuleuven.ac.be (Ives Aerts) Newsgroups: comp.sys.amiga.programmer Subject: EXAMINE_NEXT problem, how does amigados do it ? Message-ID: <91133.150111GUTEST8@cc1.kuleuven.ac.be> Date: 13 May 91 14:59:11 GMT Organization: K.U.Leuven - Academic Computing Center Lines: 37 I have to implement an examine next function for my device and can't find one that works efficiently. From what I've read I conclude that I can only use the disk key and filename information from the supplied FileInfoBlock to determine what's the next directory entry to examine. The supplied lock doesn't have to be the same as the one passed in the previous examine or examine next call and the file info block can be a new one with the diskkey and filename fields copied from the previous FileInfoBlock. I allso can't store any intermediate information in a structure or variable owned by myself 'cos there's no way to find out when I can clear this information (which would lead to an out of memory situation after a number of examine/examine next calls) Therefor only the diskkey and filename from the last FileInfoBlock can be used. Correct me if this is wrong. The solution I came up with is this one: Allways examine the directory entry with the smallest diskkey larger than the one in the FileInfoBlock. This way I won't run into problems if the last diskkey points to a file or directory that has been deleted since the examine next call. Trouble is that I have to traverse the whole directory each time to find the smallest diskkey I can pass on. This is quite an amount of overhead for large directories. I allso won't catch any new files with a small diskkey that appear while scanning the directory. Anyone who came up with a better solution ? And to the folx at commodore (I guess randell should know this) how does amigados do this ? ------------------------------------------------------------------------ Ives Aerts | IBM definition SY-34378 GUTEST8@BLEKUL11.BITNET | A signature consists of sequences of gutest8@cc1.kuleuven.ac.be | non-blank characters separated by blanks. ------------------------------------------------------------------------