It sounds like data is being buffered: 351 -336 = 15.
Try calling sourceFile.MessageEnd(). If you get an exception, then you will need to use a different technique.
Since you are at the end of your data stream you may be able to induce a MessageEnd() with a call to PumpAll().
You can wrap the code above in a C++ block to cause the destructors to run, which will implicitly call MessageEnd():
{
FileSource sourceFile("first.txt", false, ...);
sourceFile.Pump(fileSize - 512);
sourceFile.Skip(512);
}
If you want to explicitly control MessageEnd(), then use the following. It is how the library does it when needed:
StreamTransformationFilter* x = NULL;
FileSource sourceFile("first.txt", false, x=new StreamTransformationFilter(...));
sourceFile.Pump(fileSize - 512);
sourceFile.Skip(512);
x->MessageEnd();
Jeff