good point i didnt look at that but either way, you can just add a 1 to the random(100), and when you grab the value from the ptr you just -1, however, if the length is going to be below 255 bytes, just use the first byte to record the length of the data when it is written.Originally Posted by User137
obviously you can also do larger by allocating upto 4 bytes... or even 8 bytes to record datalen
also TMemoryStream is a class, which will most likely be slower, classes are created on the heap (which is slower btw). also he asked how to check manually, using a memory stream would be cheating.
anyways the problem you will have (if you were do check without knowing the size from a header or via api), many files can contain terminators... lol (null chars), exe files for example.
-Colin
Bookmarks