C# streamwriter.Write not printing entire string

Started by
1 comment, last by Chaotic_Attractor 16 years, 1 month ago
I am trying to write the output of a disassembled shader to a file.

Effect effect = Effect.FromFile(device, filename, null, null, ShaderFlags.None, null);
string text = effect.Disassemble(false);

stream.WriteLine(text);

I have checked the string "text" in the editor and it is complete, but when it is written to the file, the last few lines seem to be cut off. I have tried splitting the string and writing each of the split strings to the file, but that doesn't seem to help.
Strength without justice is no vice; justice without strength is no virtue.
Advertisement
Are you .Flush() 'ing your stream after you write it?
That did it. Thanks.

I was flushing beforehand. When I tried split the larger string into substrings, I flushed between strings, but not after the last one.

I tried converting the string into a character array and told it to output the number of characters in the array. Especially in this case, why would there be data still left in the output buffer?
Strength without justice is no vice; justice without strength is no virtue.

This topic is closed to new replies.

Advertisement