You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Since Dynamic strings move around in memory with each string assignment, the contents of a dynamic string array will not form a single large block of memory. In other words, they will not be stored exactly "sequentially" in memory.
So, for a Dynamic string array, you have to read each individual array element from the string array and then write it to disk (or concatenate a few together and write them as one operation).
Likewise, when reading a dynamic strings from disk, the memory has to first be reserved for each string, and this will be allocated in the first string block that contains enough free space for the string.
This means you have to either read/write strings individually, or say, read a large block of the disk file (say, up to the $STRING size) and parse the individual strings from that block once it is in memory. Reading and writing large blocks from/to disk files is usually always faster than reading/writing line by line, but it requires more code and more memory during the operation.
There is no simple way around this fact as far as dynamic strings go... sorry!
Maybe if you can tell us what sort of data are you wanting to load/save, we may be able to offer more specific advice or an alogrithm that will speed up your code.
For example, if your data could be stored in a different manner, it may make the block read/write operation much easier to handle.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment