473,387 Members | 3,801 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,387 software developers and data experts.

"= : left operand must be the l-value"

Markus
6,050 Expert 4TB
I have had a look on google but nothing conclusive shows up. Anyway.

I'm wrapping some of the Windows GDI API for the PHP project. In particular, in accepting some user-input and then creating a LOGFONT structure with that data. However, the problems comes when I'm trying to set the data for LOGFONT.lfFaceName. This member is of type WCHAR[32]. The title-error occurs whenever I do something like (simplified):
Expand|Select|Wrap|Line Numbers
  1. lfont.lfFaceName = (WCHAR *)TEXT("Test");
  2.  
I'm sure I'm missing something newbie-level here.
Mar 18 '10 #1
2 3030
newb16
687 512MB
If it were char*,
strcpyW(lfont.lfFaceName, TEXT("Test");
there must be strcpy equivalent for WCHAR
Mar 18 '10 #2
weaknessforcats
9,208 Expert Mod 8TB
There is no such thing as strcpyW.

It's wcscpy.

I expect you want to use the secure version wcscpy_s.

TEXT is a TCHAR macro. A TCHAR is either char or WCHAR depending upon whether your project is built for ASCII or Unicode.

That means that using TEXT on a WCHAR member ain't gonna work it the project is set to ASCII.

And, in fact, there is no WCHAR member of LOGFONT. Instead there is a TCHAR member.

And that means you want to use the TCHAR mapped function for your copy which is believe is _tcscpy. _tcscpy is a macro. It resolves to strcpy for ASCII and _mbscpy for Unicode. There are about 75 macros like this.

When you use TCHAR, there should no char or WCHAR in your program. There should be TCHAR only.
Mar 19 '10 #3

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

Similar topics

2
by: Kostatus | last post by:
The following code worked perfectly fine until i modified an unrelated part of the program: this->dungArea.mBlocked = mioS.mio_dungArea.mFlags & isBlocked; after that i started getting the...
8
by: Ben | last post by:
(I am using gcc 3.2 on RH 8) int name (struct str *name) I call the above function like this: struct str buf; int conf = name(&buf); int j; for (j=0; buf.address; j++) {
16
by: jose_luis_fdez_diaz_news | last post by:
Hi, If I don't include <libgen.h> I get then warnig below in regcmp call: warning: improper pointer/integer combination: op "=" but if I include it the warning is not shown, but them program...
59
by: Pierre Quentel | last post by:
Hi all, In some program I was testing if a variable was a boolean, with this test : if v in My script didn't work in some cases and I eventually found that for v = 0 the test returned True ...
3
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question. I was wondering if there is anything in C# that corresponds to VB's "Left" function? I simply want to retrieve the leftmost characters of a string and I...
16
by: Mr. Ken | last post by:
Left shift by negative numbers, will I get 1/2? Thanks.
3
by: mehdi | last post by:
I have a field that is a memo and I have a report displaying the text in that memo. What I need to know is how to "justify" the text right to left. The reason is in arabic and persian...
14
by: Jess | last post by:
Hi, I read about operator overloading and have a question regarding "operator->()". If I have two classes like this: struct A{ void f(); }; struct B{
6
by: Lighter | last post by:
How to read "The lvalue-to-rvalue, array-to-pointer, and function-to- pointer standard conversionsare not applied to the left expressions"? In 5.18 Comma operator of the C++ standard, there is a...
2
by: Reiki Evolution | last post by:
Hi, Hopefully someone can help me here. I am recoding my web site. The original site was just in HTML but I am teaching myself CSS for the new site. My new site consists of three columns: a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.