Windows Unicode C++ Stream Output Failure

前端 未结 4 1666
悲&欢浪女
悲&欢浪女 2020-11-30 09:27

I am currently writing an application which requires me to call GetWindowText on arbitrary windows and store that data to a file for later processing. Long story short, I no

4条回答
  •  旧巷少年郎
    2020-11-30 09:36

    Are you always using std::wcout or are you sometimes using std::cout? Mixing these won't work. Of course, the error description "choking" doesn't say at all what problem you are observing. I'd suspect that this is a different problem to the one using files, however.

    As there is no real description of the problem it takes somewhat of a crystal ball followed by a shot in the dark to hit the problem... Since you want to get Unicode characters from you file make sure that the file stream you are using uses a std::locale whose std::codecvt<...> facet actually converts to a suitable Unicode encoding.

提交回复
热议问题