473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
May 7 '07 #1
2 5621
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...
May 7 '07 #2
ajayraj
21
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 );
May 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Jeff Gilchrist | last post by:
I have tried searching the newsgroup along with the GCC site and could not find what I think is probably a simple solution. I am using a 64bit unsigned long long integer and can manipulate 64bits...
7
by: No Spam | last post by:
----snip #define POSITIVE_INTEGRATOR_SATURATION 0x03000000L // #define NEGATIVE_INTEGRATOR_SATURATION 0xFD000000L // long integrator; integrator=0;
6
by: vb | last post by:
Hi all, I ran the follwing program on windows-XP(86 architecture) using gcc. #include <stdio.h> int main() { char ch='a'; printf("%u %u\n",sizeof(ch),sizeof('a')); return 0;
23
by: Akhil | last post by:
Since a character constant is an int value represented as a character in single quotes,so it is treated as a 1 byte integer now look at the following snippet. #include<stdio.h> int main(void)...
6
by: fctk | last post by:
hello, i'm trying to compile this small program: int main(void) { unsigned long int max; max = 4000000000;
15
by: wizardyhnr | last post by:
i want to try ANSI C99's unicode fuctions. so i write a test program. the function is simple, but i cannot compile it with dev c++ 4.9.9.2 under windows xp sp2, since the compiler always think that...
26
by: kerravon | last post by:
The following C program: int main(void) { int x = -2147483648; return (0); } Produces the following warning:
35
by: rajash | last post by:
Hello everyone, Thanks again for all the suggestions, though I think some people are a bit fussy in their answers. Here is a solution to Exercise 1.14. It deals well with control characters...
2
by: Mirco Wahab | last post by:
After reading through some (open) Intel (CPU detection) C++ source (www.intel.com/cd/ids/developer/asmo-na/eng/276611.htm) I stumbled upon a sketchy use of multibyte characters - - - - - - - - -...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.