Hello guys,
I am trying to write a code to find out no of characters in a multibyte UTF8 encoded string.

Code:
#include<stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main(int argc, char** argv)
{
    string tring = argv[1];
    int count = 0;
    int length = 0;
    int number = 0;
    cout<<"Length of string"<<tring.length()<<'\n';
    cout<<"String iss " <<argv[1]<<'\n';
    length = mblen((char*)(ptr), 40);
    cout<<"Length  " << length <<'\n';
    cout<<"Total number is "<<number<<'\n';
  return 0;
}
I have written the code above, used mblen to find out length/byte of the char being pointed. But it returns -1.

Any help/pointer will be appreciated.

OS : RHEL 4.0
Compiler : g++