0

How to enter a string using DMA ,if we don't know the the length of string ?

Means user entering a long string in which he don't have any idea about length of string ?

31st Jan 2020, 6:59 AM
Vipin Singh Negi
Vipin Singh Negi - avatar
1 Answer
+ 2
There's no simple rule about this. IMHO the code author can generally allocate a reasonable amount of bytes in the beginning. The memory block can be resized on the event it no longer suffice the necessary buffer size. I once read (also in SL), that the common resize multiplier is 1.5; e.g. if you allocate 100 byte in the beginning, you resize the memory block by adding 150 (1.5% from the initial buffer size), you then have 250 bytes on the first resize. But again, there is no specific rule mandating this calculation, you may adapt as per your predictions or project requirement, as you see fit 👌
31st Jan 2020, 7:21 AM
Ipang