Start with the debugger.
Put a breakpoint on the line:
subtitleNewFile.Write(subNumber,dataSize1);
And run your app. When it hits the breakpoint, start looking at exactly what is in the variables
subNumber
and
dataSize1
- that should give you a clue as to exactly what values you are trying to write to the file. When you know that, you can start looking at exactly why the file content is not what you expected.
If the length is showing in the debugger as 24, and there are no extraneous spaces in the string, then you need to look at exactly how you are checking the file content, and then at the
subtitleNewFile
class to find out what you have doe to it when you created the stream.
We can't do any of that for you!