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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

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

    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.lfFaceN ame. This member is of type WCHAR[32]. The title-error occurs whenever I do something like (simplified):
    Code:
    lfont.lfFaceName = (WCHAR *)TEXT("Test");
    I'm sure I'm missing something newbie-level here.
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    If it were char*,
    strcpyW(lfont.l fFaceName, TEXT("Test");
    there must be strcpy equivalent for WCHAR

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      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.

      Comment

      Working...