Results 1 to 6 of 6

Thread: wchar_t... (C++)

  1. #1
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default wchar_t... (C++)

    I was doing a code test on this to see what i could do with wchar_ts and i then relize no matter how small i start, it will still act as a pointer... None of my tuts say anything about how to use this International ASCII thinger... Some one give me a little example on how i could use the wchar_t?

    Download Links:
    Links are hidden from guests. Please register to be able to view these links.
    Last edited by kohlrak; 1st-September-2005 at 07:30. Reason: Subscribing to thread...

  2. #2
    Join Date
    Aug 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It's not a pointer, rather the value is being used as an integer. The cin/cout streams are not designed for wide characters and this is what is causing your problem. Any program which works with wide streams should instead use wcin/wcout:
    Download Links:
    Links are hidden from guests. Please register to be able to view these links. Also, do not mix narrow streams and wide streams in the same program (unless you've purchased stock in Advil ). Good luck!

  3. #3
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    gee... i wonder what would happen... Or is it one of those deals of keeping track of what's Unicode and what's not? Jeeze... this thing... lol I think that's what you're talking about but i'll have to try later. Now to make all my programs unicode... but i'll save that for tomarrow. (which is when you'll all read this.) I see it still has the getline and stuff.


    what would we use for wide char based fstream? And when you calculate them, is there anything special about them if you use them for If state ments and calculations? If you want to add the value of a letter to "int"? Also i tried using strings and got this...

    Input: Fran�ias
    Output: Francias
    Download Links:
    Links are hidden from guests. Please register to be able to view these links. That would also need fixed. And i'm gonna sticky this when i get enough currency on the forums cause i know this is usually avoided in documentation.

    ADDITION: Stickied! Now to have all the questions finished answered then it'll make a great help to the community.
    Last edited by kohlrak; 1st-September-2005 at 07:10.

  4. #4
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    Hmm, if you want a thread stickyied here, just Pm me and I'll do it for you, its not really a problem, and I know a few problems here can take a while to be given the right attention. Donating 1000 points for your trouble

  5. #5
    Join Date
    Aug 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, most programs shouldn't need to mix the two (either you want to provide international support or not) it's just a matter of, when I was trying to learn this stuff I pulled my hair out trying to figure out why wcin wouldn't read after a cin. Though it is a foolish thing to do in a real program (a cast would serve well enough in turning a wide char into a standard if you really need one). As for fstream theres, you guessed it, wfstream - wifstream and wofstream. As for their functionality, I'd assume that it's the same because they're templatized but as I haven't really used 'em that much don't take my word for it.

    EDIT: Oh, for the string, you need our friend wstring instead

    You are right on the half-muled documentation on the subject though
    Last edited by Deepak420; 1st-September-2005 at 14:13.

  6. #6
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quite generous of you, coderator. Even though that's about double of the price for a sticky. I thought i'd sticky it thought, because it is undocumented and it'd save others alot of trouble looking if they could find it here. Unlike my other issues, this one in particular is universal in all API and is often igored. Just like directx and the SFC api, the documentation is... null... void...

    Addition: cin >> will not accept wstrings. And wcin.get(variablehere); won't work either. er... How do we input strings?

    Another Addition: wow... what about arrays? wcin.getline isn't working. o.O

    Yet another addition: Dude, i just retried your code example of wchar_t usage... it still comes out int...

    I just checked out 2 ".h" files (wctype.h and wchar.h) and i still have nothing...
    Last edited by Stark; 3rd-November-2005 at 01:22.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About Us

We are the oldest retro gaming forum on the internet. The goal of our community is the complete preservation of all retro video games. Started in 2001 as EmuParadise Forums, our community has grown over the past 18 years into one of the biggest gaming platforms on the internet.

Social