Re: Stdio.Buffer, need a way to revisit old positions in the output
"Stephen R. van den Berg" <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
Per Hedbor () @ Pike (-) importm?te f?r mailinglistan wrote: >By the way, you can already do this: >int i = sizeof(buffer); >buffer->add_padding(4); >... >int l = sizeof(buffer)-i; >buffer[i] = l>>24; >buffer[i+1] = l>>16; >buffer[i+2] = l>>8; >buffer[i+3] = l>>8; Yes, well, apart from the fact that you can't use the add_int32(), there is another difficulty here: the sizeof() and the [] operators are relative to the start of the buffer. The start is a moving target however, since some of it might have been flushed to the descriptor already. I'll rethink the deluxe-solution once more. If I can't come up with something which easy to implement, I'll use my original proposal first, but I'll document it as being not-for-production use; so that if someone implements it the "right" way, I'll fix the driver to the new methods. -- Stephen.