You are here:

C++/Unicode character print using C or C++


Dear Titus,

I want to print some unicode character(of Hindi language) as output. what are the procedure I have to follow? Is there any library function or header file for Unicode character printing. Please help me. if possible please give some example. Thank you in advance.  

Dear Nava:

This is really not my expertise, but I will try to help as much as I can.

The first thing you will have to do is set your machine to be able to type Hindi fonts.  You may already know this, but I am not sure from the question whether you do or not.  I do not have access to a system that is set up to type Hindi fonts.  Even so, if you know the two byte code (short) for the fonts you want to represent you may not have to have Language support for Hindi fonts.  But you will have to use the exact code instead of the actual font (in a string) in a string of such codes.  The next thing you need is some Hindi fonts.  I went on and I found one Hindi font you can download for free.  Then you will have to set the font in your application.  Below is a code sample for setting font for a CEditView in Visual C++:

void CNotesView::OnInitialUpdate()
  // TODO: Add your specialized code here and/or call the base class
  CEdit &curEditor = GetEditCtrl();
  CFont *SimpleFont = new CFont;

  SimpleFont->CreatePointFont(120, "Times New Roman");

Finally you will declare the character strings in the code.  Unicode characters are two bytes long each not the one byte characters of the ASCI character string.  Below, is a coding sample that will help you set that up in the code:

#define _UNICODE   // Tell C we're using Unicode, notice the _
#include <tchar.h>   // Include Unicode support functions
#include <stdlib.h>
#include <string.h>
typedef unsigned short wchar_t;
#define UNICODE          // No underscore this time
#include <windows.h>
wchar_t mystring[] = _TEXT("flipcode");

I hope this helps you.  I tried to cover all bases.  

Also, you can create your own characters.  You will find the format of a font file at  You can also use software applications to help you create your fonts  First you get bitmap images of each character, then you put each on into the software to represent each character.  The example I saw was mapping English characters, however.


All Answers

Answers by Expert:

Ask Experts


Titus B. Ledbetter, Jr.


C , MFC, Object Oriented, Artificial Intelligence


I have over ten years experience in the field of Computer Science, five years experience developing C/C++. I recently wrote a chess program using Object Oriented, C++, MFC.

Master's Degree Computer Science from Johns Hopkins

©2016 All rights reserved.