I'm probably missing something easy on this one...but anyhow.
I have a file with what essentially amounts to several PChar values in a record. Now this value is fine in memory, but isn't working too well on disk (naturally since it's a pointer value). For disk the value is an array of characters.
The problem comes in two things:
1) I don't know the size of this field, which can be variable.
2) Fortunately it will always have #0 at the end, but will always terminate in the file with #0. Which means the field on disk is variable. Which means I can't just read a buffer size, pick the field out in memory, and move on.
This is because of #1 - I would need to accurately position the file pointer back to the character after #0 to accurately read the next record.
Now the only thing I'm thinking of that's possible is to start reading the field byte by byte until I hit #0. While this would work, it would have some performance issues attached to it (unless memory-mapping this file would negate that).
But since it's a null-terminated string I'd have to think there's an easier way to handle this. Am I on track with my idea or is there really an easier way to handle it?
It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
I have a file with what essentially amounts to several PChar values in a record. Now this value is fine in memory, but isn't working too well on disk (naturally since it's a pointer value). For disk the value is an array of characters.
The problem comes in two things:
1) I don't know the size of this field, which can be variable.
2) Fortunately it will always have #0 at the end, but will always terminate in the file with #0. Which means the field on disk is variable. Which means I can't just read a buffer size, pick the field out in memory, and move on.
This is because of #1 - I would need to accurately position the file pointer back to the character after #0 to accurately read the next record.
Now the only thing I'm thinking of that's possible is to start reading the field byte by byte until I hit #0. While this would work, it would have some performance issues attached to it (unless memory-mapping this file would negate that).
But since it's a null-terminated string I'd have to think there's an easier way to handle this. Am I on track with my idea or is there really an easier way to handle it?
It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.