954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Wide ifstream?

I need to read one wide Charecter(wchar_t) from a file once but it says:
"ambiguous overload for 'operator>>' in 'WER >> mont'

The part that also confuses me is that it writes the Charecter just fine.

It is only one Charecter not a string if that makes a difference.
Thanks.

Zssffssz
Junior Poster
180 posts since Sep 2011
Reputation Points: 6
Solved Threads: 2
 

Please post a complete test program that exhibits the error.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Really simple:

wchar_t qwer;
ifstream asdf ("DATA.dat");
asdf>>qwer;
asdf.close();

I know that there is only one wide Charecter in data.dat.

Zssffssz
Junior Poster
180 posts since Sep 2011
Reputation Points: 6
Solved Threads: 2
 

Why are you using ifstream instead of wifstream? If you're working with wide characters, it's generally a good idea to use wide character oriented classes.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

I thought that only applied to cin and cout (as wcin and wcout). Does normal stuff go though these wide vareants nomaly, There's going to be two other lines of non wideness in the file (it a savegame thing)?

Zssffssz
Junior Poster
180 posts since Sep 2011
Reputation Points: 6
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: