Silverous Black
Silverous Black

Reputation: 40

Why does wofstream output stop at a certain point

I am trying to write into a file wchar_t(s) from value 0 to max (FFFF or 65,535). The process is successful but when I opened the output file it ended at value 256 with no symbol. Why does this happen?

I've tried making the program sleep and instead wchar_t I used wstring (wstring is written instead of the wchar_t directly) but it all ended the same way.

//the loop

for (int y = 0; y < 256; y++) {
// "out" is declared as wofstream
            out << y + 1 << ":\t";
            for (int x = 0; x < 256; x++) {
                wchar_t c = ((y * 256) + x);
                wstring u;
                u = c;
                int l = (y * 256) + x;
                out << "[" << l << " :: " << u << "]";
            }
            out << "\n";
        }

The last in the file should be "[65535 :: (symbol here)]" but it ended at "[256 :: (blank and no closing bracket)"

Upvotes: 0

Views: 61

Answers (0)

Related Questions