>Proposed solution: > >1. Write the number of stimuli to the file. >2. Write the size of the data handle for stimulus 1 to the file. >3. Write the handle to the file (I can do this) >4. Clear data handle, present next stimulus, record data. >5. Get length of file, and append handle length and then the handle. >6. Repeat. > >To read the information back in, I just need to step through the file to >each new stimulus and read the handle back into memory. This seems quite "doable", but I wouldn't "get length of file" in step 5; I'd just write a separator record, (for insurance and ability to human-locate block endings) leave the file pointer at the end of the file, and go back to step 2. When reading, you'd read how many "blocks" you need to retrieve, then the length of the first block, then that many bytes. This will leave the file pointer at the start of your separator record. Read it, followed by the length of the second block. Repeat. >PS - I thought about putting each data handle into a seperate resource and >then reading those back one at a time - this would be very easy but is it >cosher? IF the maximum number of stimuli is fairly small - say dozens, _maybe_ hundreds, definitely not thousands - this would work. However, access time will be much slower (I think) than a straight data-fork write & read, especially as the file gets larger. And you can hit a limit on the number of resources or size of resources if you aren't careful. There really are reasons Apple has _always_ said "the resource manager is not a database"... Bill