On Sun, 5/28/17, JB via use-livecode <use-livecode@lists.runrev.com> wrote: > > Subject: File - read from EOF > To: "How to use LiveCode" <use-livecode@lists.runrev.com> > Cc: "JB" <sund...@pacifier.com> > Date: Sunday, May 28, 2017, 2:23 AM > > I want to read a file as binary of any > size but as crazy as it sounds I want > to read in sections form the EOF and > stop at the beginning of the file > instead > reading from the start to EOF. > > I have no problems opening, reading > and > closing files or reading in sections. > > Does anyone know the easiest way > to determine when I reach the start > of the file similar to using EOF to > stop reading at the end of the file? > > JB >
Hi JB, You could always read the file straight into a variable and then check the number of bytes. But if it's a very large file then you could run out of memory space (at least until we get a 64-bit engine on Windows) >From your description, it sounds like you don't need the entire content and >want to cruise around the file on disk to extract bits. In that case, you can quickly determine the file size using the 'detailed files' functionality. I wrote a utility function for that a long time ago; here it is: -- function qrtUtil_FileSize pFilePath local tFolderPath, tFileName set the itemDelimiter to slash put item 1 to -2 of pFilePath into tFolderPath put item -1 of pFilePath into tFileName local tDefaultFolder, tDetailedFiles put the defaultFolder into tDefaultFolder set the defaultFolder to tFolderPath put the detailed files into tDetailedFiles set the defaultFolder to tDefaultFolder filter tDetailedFiles with (tFileName & ",*") set the itemDelimiter to comma return item 2 of tDetailedFiles end qrtUtil_FileSize -- HTH, Jan Schenkel. ===== Quartam Reports & PDF Library for LiveCode www.quartam.com ===== "As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld) _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode