Thread: Letting C++ program show special characters such as æ, þ, ó

  1. #46
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by anon View Post
    A side question, now that we have managed to display and perhaps input special characters, what does it take to make functions like toupper/tolower work with them?
    Use the wide versions?
    That is, if you use the wide version solution.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #47
    The larch
    Join Date
    May 2006
    Posts
    3,573
    When I use CodePlug's wconbuf and pass this:

    Code:
    display_char(std::toupper(SMALL_LATIN_Ae, std::locale()));
    it displays the same character with the same value...
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #48
    Registered User
    Join Date
    Nov 2008
    Posts
    36
    Where do I get a compiler for Code::Blocks that supports wide streams?

  4. #49
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    We already went over that one. Visual C++ supports wide streams and, indeed, Code::Blocks can use that compiler.
    There may also be other ports of GCC that supports them, or other compilers, but Visual C++ is a no-slouch compiler. It is, in fact, a very good compiler.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #50
    Registered User
    Join Date
    Nov 2008
    Posts
    36
    Quote Originally Posted by Elysia View Post
    We already went over that one. Visual C++ supports wide streams and, indeed, Code::Blocks can use that compiler.
    There may also be other ports of GCC that supports them, or other compilers, but Visual C++ is a no-slouch compiler. It is, in fact, a very good compiler.
    Hehe I went over Visual C++ and I found it bit confusing, maybe I should just start using it? The problem is how much disk space it takes, 1.8GB while Code::Blocks takes 120MB.

    Do you know of a website that tells me what is different in Visual C++ from Code::Blocks or something similar because I noticed some factors of coding were a bit different in Visual C++ than Code::Blocks?

  6. #51
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Just to be clear, Visual Studio is the IDE and Visual C++ is the compiler.
    Oh, you are free to use the IDE, if you want. It's my favorite IDE. But you can also set Code::Blocks to merely use the compiler, if you want. It supports wide streams.
    And I cannot think that 1.8 GB of space is a problem for today's hard drives?

    And I don't know what you mean with "different factors of coding"... They're the same language, and works in pretty much the same ways, the IDEs.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #52
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> wouldn't I need a command to put in the program to change the font
    Vista has a new API SetCurrentConsoleFontEx(). Prior to Vista there's not much you can do except to mess with the registry to make a console with a particular title use a particular font.

    >> If it is MinGW then it might not support wide streams
    The default STL implementation that comes with MinGW does not support wide streams. If you download and use STLPort, them you'll have wide stream support.

    >> what does it take to make functions like toupper/tolower work with them?
    You need a non-"classic" locale. For non-wide, the locale would also needs to be associated with the code page that contains the upper/lower of the character you're messing with. For wide chars, any non-classic locale seems to do the job in the MS-CRT.
    Code:
        locale l("English_United States.1252");
    
        display_char(SMALL_LATIN_Ae);
        cout << "std::toupper = ";
        display_char(std::toupper(SMALL_LATIN_Ae, l));
    
        display_char(SMALL_LATIN_THORN);
        cout << "std::toupper = ";
        display_char(std::toupper(SMALL_LATIN_THORN, l));
    
        display_char(SMALL_LATIN_O_wACUTE);
        cout << "std::toupper = ";
        display_char(std::toupper(SMALL_LATIN_O_wACUTE, l));
    Code:
    U+00E6 = æ
    std::toupper = U+00C6 = Æ
    U+00FE = þ
    std::toupper = U+00DE = Þ
    U+00F3 = ó
    std::toupper = U+00D3 = Ó
    >> Use the wide versions?
    std::toupper is a template, so if you pass in wchar_t you're using wide.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  3. Results for the Encryption Contest -- June 23, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 07-07-2002, 08:04 AM
  4. Replies: 1
    Last Post: 03-12-2002, 06:31 AM
  5. Program to show the number of occurrences of words...
    By Nutshell in forum C Programming
    Replies: 5
    Last Post: 01-26-2002, 06:44 PM