[ llux @ 14.05.2007. 19:50 ] @
| Posto nisam ucio C nikako ne shvatam kako radi wsprintf funkcija:
Code: TextOut (hdc, 22 * cxCaps + 40 * cxChar, cyChar * i, szBuffer,
wsprintf (szBuffer, TEXT ("%5d"),
GetSystemMetrics (sysmetrics[i].iIndex))) ;
Znam da brojeve koje vraca GetSystemMetrics funkcija wsprintf pretvara u text ali ne kapiram kako funkcionise.
Narocito me zbunjuje ono "%5d", sta je to? A takodje i sto szBuffer ne sadrzi nista a pojavljuje se pre wsprintf.
Ima li nesto drugo sto bih mogao da koristim? Nesto iz C++ mozda? |
[ Eurora3D Team @ 15.05.2007. 01:20 ] @
wsprinf pretvara / formatira duge tipove podataka u tekst.
Prvi argument je char* buffer , drugi simbolicno opisuje sta treba da se konvertuje a treci je ono sto treba da se konvertuje.
Ispod imas simbole sa drugi argument (iz win api helpa) uvek se pocinje sa % napr "%i" znaci da je treci argument int
Pozdav
c A single character. The wsprintf function ignores character arguments with a numeric value of zero. This sequence is interpreted as type WCHAR when the calling application uses the #define UNICODE compile flag and as type CHAR otherwise.
C A single character. This sequence is interpreted as type CHAR when the calling application uses the #define UNICODE compile flag and as type WCHAR otherwise.
d A signed decimal integer argument. This sequence is equivalent to the i sequence.
hc, hC A single character. The wsprintf function ignores character arguments with a numeric value of zero. This sequence is always interpreted as type CHAR, even when the calling application uses the #define UNICODE compile flag.
hs, hS A string. This sequence is always interpreted as type LPSTR, even when the calling application uses the #define UNICODE compile flag.
i A signed decimal integer. This sequence is equivalent to the d sequence.
lc, lC A single character. The wsprintf function ignores character arguments with a numeric value of zero. This sequence is always interpreted as type WCHAR, even when the calling application does not use the #define UNICODE compile flag.
ld A long signed decimal integer. This sequence is equivalent to the li sequence.
li A long signed decimal integer. This sequence is equivalent to the ld sequence.
ls, lS A string. This sequence is always interpreted as type LPWSTR, even when the calling application does not use the #define UNICODE compile flag. This sequence is equivalent to the ws sequence.
lu A long unsigned integer.
lx, lX A long unsigned hexadecimal integer in lowercase or uppercase.
s A string. This sequence is interpreted as type LPWSTR when the calling application uses the #define UNICODE compile flag and as type LPSTR otherwise.
S A string. This sequence is interpreted as type LPSTR when the calling application uses the #define UNICODE compile flag and as type LPWSTR otherwise.
u An unsigned integer argument.
x, X An unsigned hexadecimal integer in lowercase or uppercase.
[ llux @ 15.05.2007. 08:21 ] @
Ok. A kako brojeve pretvara u tekst, jedna cifra-jedan karakter ili ceo broj-single char?
[ karas @ 15.05.2007. 09:02 ] @
Jedna cifra jedan karakter.
[ Eurora3D Team @ 18.05.2007. 01:23 ] @
Da
Npr broj 123 je "123"
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.