12-01-2024, 12:50 PM
Hi Steve, I think I have been misunderstanding the memory storage of 4 bytes per Single Type of variable. You point out
but I have always been of the impression a variable Dimmed Single would always have a max of 7 digits and so the memory of 4 bytes would be enough to hold a 7 digit number. You are pointing out that a Single declared variable is actually 1 byte per digit. That could be exactly why my routine to search the sequential file is running into problems. For the most part, all the values stored in the sequential file are of 4 digits or less.
So to correct my search routine, if the search encounters a value greater than 4 digits, it needs to count the number of digits greater than 4 and add that value to the standard 4 bytes to find the location of the next data item. Does that sound like a logical fix to locating the beginning of the data entries in a sequential file where all data items have been dimmed Single?
Quote:Take the value 12345, for example. A SINGLE variable type will easily hold that value, but that's going to be 5-bytes in length and not 4.
but I have always been of the impression a variable Dimmed Single would always have a max of 7 digits and so the memory of 4 bytes would be enough to hold a 7 digit number. You are pointing out that a Single declared variable is actually 1 byte per digit. That could be exactly why my routine to search the sequential file is running into problems. For the most part, all the values stored in the sequential file are of 4 digits or less.
So to correct my search routine, if the search encounters a value greater than 4 digits, it needs to count the number of digits greater than 4 and add that value to the standard 4 bytes to find the location of the next data item. Does that sound like a logical fix to locating the beginning of the data entries in a sequential file where all data items have been dimmed Single?