fprintf and non-ascii symbols

Discussion in 'C' started by sombrancelha, Nov 28, 2007.

  1. sombrancelha

    sombrancelha New Member

    Joined:
    Nov 28, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    I'm trying to print non-ascii symbols on a file, using

    fprintf(file_name, "%c", xxx), where xxx is the symbol number

    I'm trying to print symbols 176, 177, 178 and 219 from http://en.wikipedia.org/wiki/Code_page_850.

    When I use printf only, the result is perfect. When I use fprintf, however, I get a different output. Is there any different thing to be done?

    I'm using Dev-cpp and I'm opening files with Window's Notepad, font Lucida Console.

    Thanks in advance
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,374
    Likes Received:
    388
    Trophy Points:
    83
    How you are seeing the output of fprintf is not correct. It may be that you file viewer is doing some tricks.
     
  3. sombrancelha

    sombrancelha New Member

    Joined:
    Nov 28, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I'm getting this:

    Code:
    ±    ²² ÛÛ
    ±±±   ² Û 
     ±  °     
      °°°°°°  
        °°  ±±
      ²    ±±±
      ²²²   ±±
    Û ²²²²   ±
    Û     °°  
    Û     °   
    
    while it should be showing the following characters:
    Code:
    ░ ▒ ▓ █
    
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,374
    Likes Received:
    388
    Trophy Points:
    83
    There is wrong somewhere else because the no of characters cannot change between fprintf and printf.
     
  5. Salem

    Salem New Member

    Joined:
    Nov 15, 2007
    Messages:
    133
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Please don't PM me for 1:1 support.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice