![]() |
Virtual Arrays - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +---- Forum: Site Suggestions (https://qb64phoenix.com/forum/forumdisplay.php?fid=12) +---- Thread: Virtual Arrays (/showthread.php?tid=3285) |
Virtual Arrays - Dimster - 12-15-2024 I was wondering if anyone has worked with Virtual Arrays? These are arrays which would reside on your hard drive rather than in ram or your computer memory. From what I recently read about them, they go back to an earlier time, circa 1980's, and were part of the Basic language. The worked along the lines of Files in terms that you would open and close them, use Input or Output and a number. So to declare them it would look something like this: Dim #1, myArray(5000) Open "myArray" for Input as #1 As I understand it, the virtual array enjoyed a random access feature and its size was only limited to the size of your hard drive or thumb drive. And before you say it, I know if anyone responds to this enquiry you may be tipping off your age. RE: Virtual Arrays - bplus - 12-15-2024 Yes Random Access is like arrays permanently stored in files. Back in 80's I stored prime numbers in a massive file, might have been first factor of every number don't remember which. RE: Virtual Arrays - Dimster - 12-15-2024 Ya, I wonder what the difference would have been back then to work with either a File opened for Random access or a Virtual Array. I have multiple files which are constantly receiving updated data. They are pretty large now, can't imagen working with an array at the sizes of those files. RE: Virtual Arrays - Pete - 12-16-2024 I coded the same back in the days where memory was at a premium. 2 + 2 is... wait for it.... 4 Pete - I'm not as old as the hills, but in all fairness, the hills are better looking. RE: Virtual Arrays - madscijr - 12-16-2024 (12-15-2024, 02:58 PM)bplus Wrote: Yes Random Access is like arrays permanently stored in files. Back in 80's I stored prime numbers in a massive file, might have been first factor of every number don't remember which.Each value would have to be written with the same number of bytes, right? Can someone who knows how to do random access files post an example? RE: Virtual Arrays - bplus - 12-16-2024 Yes same amount of bytes for each record which could be divided into fields numeric type and/or fixed length strings. We did setup an RA for Dictionary words and definitions for PhilOfPerth, simple word and definition per record, try search? Oh I might have quickie example: Code: (Select All) _Title "UDT to Random Access File Test" ' b+ 2021-12-24 RE: Virtual Arrays - Dimster - 12-16-2024 Hi Madscijr, here's some code which Steve drew up for me a while ago and it helped a lot, hope it's what you could be looking for. Code: (Select All) _Title "Random Access File Demo" And oh yes, bplus also gave me a neat addition to this phone record demo where he explained how you could put a Random File within a Random File where I had been working with multiple additional entries like multiple phone numbers. I haven't found that example code but if this is what you are looking for I'll try to find that example as well? RE: Virtual Arrays - madscijr - 12-17-2024 (12-16-2024, 03:29 PM)bplus Wrote: Yes same amount of bytes for each record which could be divided into fields numeric type and/or fixed length strings. (12-16-2024, 04:30 PM)Dimster Wrote: Hi Madscijr, here's some code which Steve drew up for me a while ago and it helped a lot, hope it's what you could be looking for. Thanks to you both - this could come in handy! RE: Virtual Arrays - hsiangch_ong - 01-16-2025 liberty basic sort of worked this way to provide graphics functions from the win32 api. otherwise this would be quite inefficient. usb drives are very slow, including the 3.2 ones. i have had lousy experiences with anything version 3. one was supposed to give good performance but it became a lemon. i almost have to throw it away. what's the use of cheap storage if it's unreliable and it takes hours only to copy one gigabyte? besides, we now have _readfile$ and _writefile. there's a way to use a vls as buffer, then map it out into a _mem variable and do the "pointer" arithmetic in memory. if it requires too much ram, then do the arithmetic using get/put, lof() and other such statements of binary file access. |