diff --git a/demo/wordpad.py b/demo/wordpad.py index ed76a6ee8..300c4a1dd 100644 --- a/demo/wordpad.py +++ b/demo/wordpad.py @@ -316,11 +316,10 @@ def OpenDocument(self): buff = System.Array.CreateInstance(System.Byte, 1024) data = [] - read = -1 - while (read != 0): + while stream.Position < stream.Length: buff.Initialize() - read = stream.Read(buff, 0, 1024) + stream.Read(buff, 0, 1024) temp = Encoding.ASCII.GetString(buff, 0, 1024) data.append(temp)