-5

My code:

DrawText (hdc, TEXT ("PPPPPPP"), -1, &, DT_SINGLELINE|DT_CENTER|DT_VCENT);

Compiler gives me this erorr:

[Error] expected expression before ',' token

Thanks.

haccks
  • 104,019
  • 25
  • 176
  • 264
Janac
  • 1
  • 2

2 Answers2

2

That lonely & is the error, that's not correct syntax: the unary address-of operator & needs something to take the address of, and you're not providing an argument to the operator.

From this documentation page, the fourth argument to DrawText() is a pointer to a RECT structure which you seem to be missing.

Without seeing more of your code, it's hard to know what your particular RECT instance is called.

unwind
  • 391,730
  • 64
  • 469
  • 606
  • http://stackoverflow.com/questions/20809447/expected-identifier-or-something?noredirect=1#comment31200431_20809447 – Janac Dec 29 '13 at 22:03
1

This is because you are using unary & operator without its operand. You need an operand (which must be an l-value) for & operator otherwise its a compilation error. If you declare the RECT structure then fourth argument is a pointer to RECT, like ▭

 RECT rect;
 ...
 DrawText (hdc, TEXT("PPPPPPP"), -1, &rect, DT_SINGLELINE|DT_CENTER|DT_VCENT);
haccks
  • 104,019
  • 25
  • 176
  • 264