Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Kako radi ova funkcija?

[es] :: C/C++ programiranje :: Kako radi ova funkcija?

[ Pregleda: 2299 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

llux

Član broj: 63288
Poruke: 419
217.65.192.*



+253 Profil

icon Kako radi ova funkcija?14.05.2007. u 19:50 - pre 206 meseci
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?
 
Odgovor na temu

Eurora3D Team
Nebojsa - Programer & Vodja tima
Beograd

Član broj: 120376
Poruke: 900
195.252.105.*



+7 Profil

icon Re: Kako radi ova funkcija?15.05.2007. u 01:20 - pre 206 meseci

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.

 
Odgovor na temu

llux

Član broj: 63288
Poruke: 419
217.65.192.*



+253 Profil

icon Re: Kako radi ova funkcija?15.05.2007. u 08:21 - pre 206 meseci
Ok. A kako brojeve pretvara u tekst, jedna cifra-jedan karakter ili ceo broj-single char?
 
Odgovor na temu

karas

Član broj: 5574
Poruke: 482
*.routotelecom.com.



+1 Profil

icon Re: Kako radi ova funkcija?15.05.2007. u 09:02 - pre 206 meseci
Jedna cifra jedan karakter.
Sveti Avgustin: "Dobar hrišćanin treba da se kloni matematičara i svih onih koji daju lažna proročanstva. Postoji opasnost da su matematičari već sklopili pakt sa Đavolom, da pomrače čovekov um i da ga okuju okovima pakla."
 
Odgovor na temu

Eurora3D Team
Nebojsa - Programer & Vodja tima
Beograd

Član broj: 120376
Poruke: 900
195.252.105.*



+7 Profil

icon Re: Kako radi ova funkcija?18.05.2007. u 01:23 - pre 206 meseci
Da
Npr broj 123 je "123"

 
Odgovor na temu

[es] :: C/C++ programiranje :: Kako radi ova funkcija?

[ Pregleda: 2299 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.