Reading bytes from file
<p>I'm trying to write huffman decompress, I have a function which is trying to read byte by byte whole compressed file, but I have a problem it reads only around 150 firsts bytes and rest are skipped I cant understand why.</p>

<p>Here's the function:</p>

<pre><code>public static StringBuilder odczytBajtowy(string nazwa)
    {
        FileStream plik = null;
        StringBuilder dane = new StringBuilder("");
        try
        {
            plik = new FileStream(@nazwa, FileMode.Open, FileAccess.Read);

            int w;
            int n = 0;
            do
            {
                n++;
                w = plik.ReadByte();

                if (w != -1)
                    dane.Append(StringHelp.Reverse(Convert.ToString((byte)w,2).PadLeft(8, '0')));
            }
            while ((w &gt; 0));
        }
        catch (FileNotFoundException)
        {
            Console.WriteLine("Brak pliku {0}", nazwa);
        }
        finally
        {
            if (plik != null)
            {
                plik.Close();
            }
        }

        return dane;
    }
</code></pre>

<p>It looks like the function reads EOF before the file is really at the end. I know there is no EOF somewhere between bytes because I'm writing there only byte values.</p>
