Hi

I have a value of emdash
—

First of all I want to know Is this — a unicode

If Yes How to convert unicode i.e. — into -- using code in VC++

Regards
Karan

It is not UNICODE -- its just a character from a special font. If you print that out (see below) you will see that it has a decimal value of -105.

int main()
{
    char c = '—';
    cout << c << " " << (int)c << "\n";
    return 0;
}

So in your program just check for a character whose ascii value is -105 and change it to --.

At least that's how it works on an American keyboard and Vista Home. Other keyboards might be different, I don't know.

if I have a variable called text of type char* then

What should I write in VC++ so that it assigns emdash value in the variable text

if I have a variable called text of type char* then

What should I write in VC++ so that it assigns emdash value in the variable text

1. The emdash character has value '\x97' in most of Windows single-byte code pages (it's equal to -105 if char type is signed and 16*9+7 if it's unsigned). Look out! No emdash character in most of Windows so called OEM code pages. Alas, Windows console applications put/get OEM coded characters to/from its consoles, so you can't print this character or get it from the keyboard in console application (without some tricks, but it's the other story).
2. Type char* variable points to a single char or to an array of char, it does not contain any chars.

const char* pemdash = "\x97";
// Now *pemdash expression returns emdash character value
// See #1 above...
char emdash = '\x97'; // it's emdash in most of code pages...
This question has already been answered. Start a new discussion instead.