Please read the new rule regarding the restriction on the use of AI tools. ×

Md_Rakib_Hassan_'s blog

By Md_Rakib_Hassan_, history, 21 month(s) ago, In English

Is there any possible way to get a character Unicode value by CPP? I was trying it but I can't find any good article on it.
In Python, we can get it by using the ord() function. So is CPP have the same kind of function for getting a character Unicode value?

  • Vote: I like it
  • +8
  • Vote: I do not like it

| Write comment?
»
21 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

What would you want to use it for? Do you actually need unicode characters and their values, or are basic ascii characters and their values enough for what you are trying to do?

»
21 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

Just cast the character to int:

cout << (int)L'Ω';

It should output 937.