To explain further, those "white-spaces" are null characters represented as CHR$(0). They are added to strings less than their dimension limits, so text = "abc" would be recorded as abc with 277 CHR$(0) characters following the "c" in your DIM text as STRING * 300 example.
Fell's line of code will strip the null characters off your text variable.
Pete
//put2 adds a 2-4 byte length descriptor to the data
//(used to PUT variable length strings in RANDOM mode)
void sub_put2(int32 i,int64 offset,void *element,int32 passed){
When I first started using RA files, I did not take the time to study TYPE or fixed length strings. I don't think I even knew what a fixed length string was. So I did get that RA files had to have a way to access records, and if the string was not the correct length, it would cause a bad record error. I found a way around all of this by adding +2 to the LEN statement that was set to the length of the longest string I wanted stored...
Interesting.
When I first started using RA files, I did not take the time to study TYPE or fixed length strings. I don't think I even knew what a fixed length string was. So I did get that RA files had to have a way to access records, and if the string was not the correct length, it would cause a bad record error. I found a way around all of this by adding +2 to the LEN statement that was set to the length of the longest string I wanted stored...