CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Join Date
    Jun 2006
    Posts
    46

    British keyboard £ in console app

    hi all, when i try to

    cout << "£";

    it outputs a char 'u' with dash above ( code -93 ).
    i found "£" code is -100, but it's awkaward to type "(char)-100" every time :-).
    are there any project settings to fix it ?
    thanks for help.

  2. #2
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: British keyboard £ in console app

    try '£' instead of "£"

  3. #3
    Join Date
    Jun 2006
    Posts
    46

    Re: British keyboard £ in console app

    i have tried. same result.

  4. #4
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867

    Re: British keyboard £ in console app

    First of all, are you actually based in the UK? You might have forgotten this but in the bad old days of DOS, each country had a country code and code page for console support. The code page for the UK was 850 if I remember correctly. Not sure about the country code but it might have been 44. If these don't match your machine, you won't see pound signs until you make them match. There was a driver called keyboard.sys that provided the appropriate symbols. In fact, even Windows has a similar concept.

    Open up a console window on your screen, then hold down the shift key whilst hitting the number 3. Do you see pound signs?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  5. #5
    Join Date
    Jun 2006
    Posts
    46

    Re: British keyboard £ in console app

    i forgot to add i am using VS6 sp6.
    yes, i am in uk.
    in both: "cmd.exe" and "command.com" the "£" is rendered correctly while shift + 3.

  6. #6
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867

    Re: British keyboard £ in console app

    As far as I can tell, the '£' sign is character 163 (0x00A3)
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  7. #7
    Join Date
    Jun 2006
    Posts
    46

    Re: British keyboard £ in console app

    163 on my machine is 'ú'
    156 on my machine is '£'

    i meant -100 is "£", because char is signed byte

  8. #8
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867

    Re: British keyboard £ in console app

    Strange.... so did you find it eventually?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  9. #9
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: British keyboard £ in console app

    1. did you check font
    2. did you check the language in system
    3. did you check language of keyboard
    4. did you try char& = 163? or char = 156?

  10. #10
    Join Date
    Jun 2006
    Posts
    46

    Re: British keyboard £ in console app

    left alt + num key 163 on my machine is 'ú'
    left alt + num key 156 on my machine is '£'

    above shows in any program( notepad, wordpad, pure console command line, with every font.

    char c = 163;
    cout << c;

    renders 'ú', so it is consistent.

    all settings in system are set to english(uk).
    this problem shows only in a console app, any other application ( for example mfc with GUI ) works fine.

  11. #11
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: British keyboard £ in console app

    i heard some guy say, you had to change some settings in console.

    but im not sure though..

    look here:

    http://www.lookuptables.com/

    it shows axactly as u say

  12. #12
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: British keyboard £ in console app

    try ALT+163 in your IDE does it show up a £?

  13. #13
    Join Date
    Jun 2006
    Posts
    46

    Re: British keyboard £ in console app

    it is like in the table. so this part is ok, i guess.
    in IDE it works like in notepad; alt+163 is 'ú', as table says.
    i can't see any console settings for that, is there a conf file ?

  14. #14
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867

    Re: British keyboard £ in console app

    I've lost track of the current situation. Are you saying that it now works when you specify character 156 - or are you saying that it should work but it doesn't?

    If it's still not working, why don't you zip up the project and post it here so that someone else can see if the problem is reproducable? When zipping up a project, don't bother to include the Debug or Release folders. Also, depending on the size of the project you might need to leave out any files that the compiler will recreate (such as clw, aps, ncb, opt & plg files).
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  15. #15
    Join Date
    Jun 2006
    Posts
    46

    Re: British keyboard £ in console app

    you mentioned that

    "the '£' sign is character 163 (0x00A3)"

    but according to the http://www.lookuptables.com/extend.gif - it is not.
    so my system works exactly as table says, and this does not have to be a project.
    simple cout << "£" will output 'ú' in VS6 console app, in GUI app it will output correctly '£'.

Page 1 of 2 12 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured