character constant is tool long of its type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Suyash Upadhyay
    New Member
    • Mar 2007
    • 34

    character constant is tool long of its type

    Hello all,

    I am getting warning with following line:-

    wchar_t d=L'aa';

    Warning : character constant is tool long of its type

    Please help me to solve this problem..

    Thanx

    Suyash
  • dumparun
    New Member
    • Feb 2007
    • 26

    #2
    Originally posted by Suyash Upadhyay
    Hello all,

    wchar_t d=L'aa';

    Warning : character constant is tool long of its type
    this should work
    wchar_t d=L'a';

    i think it was a typo error...

    Comment

    • ajayraj
      New Member
      • May 2007
      • 21

      #3
      Originally posted by dumparun
      this should work
      wchar_t d=L'a';

      i think it was a typo error...

      Now here while you use wchar_t then only one character given similar to a char.
      If u want to specify more than one character then use array or allocated memory.
      And wchat_t is nothing but .
      typedef unsigned short wchar_t;

      If u want to give more than one character to it then you can use.

      wchar_t* pDataType = new wchar_t[3];
      pDataType = L"aa";

      or

      // Simply copying of the type wchar_t
      wchar_t* pData = L"aa";
      wchar_t* pCopyData= new wchar_t[3];
      // You can copy and use the same.
      wcscpy( pCopyData , pData );

      Comment

      Working...