Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is the difference: sprintf and wsprintf ?

191 views
Skip to first unread message

cnlai

unread,
Jan 9, 2004, 7:27:59 AM1/9/04
to
I keep thinking what is the difference between "sprintf" and "wsprintf"
in terms of usage ?

thanks.

Frane Roje

unread,
Jan 9, 2004, 7:35:08 AM1/9/04
to
swprintf is for wide characters(I think)

--

---------------------------
Time to get it done!

Remove (d*elete*) to reply


r_z_...@pen_fact.com

unread,
Jan 9, 2004, 10:33:37 AM1/9/04
to
On Fri, 9 Jan 2004 13:35:08 +0100, "Frane Roje"
<frane.roje(d*elete*)@st.hinet.hr> wrote:

>swprintf is for wide characters(I think)

Good think.

To clarify _and_ confuse:
wsprintf is a similar function that accepts TCHAR arguments (switches
depending on whether UNICODE is defined), and has somewhat different
behavior.


>
>--
>
>---------------------------
>Time to get it done!
>
>Remove (d*elete*) to reply
>
>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

Tim Robinson

unread,
Jan 9, 2004, 2:06:23 PM1/9/04
to
"cnlai" <cn...@pc.jaring.my> wrote in message
news:3FFE9E4F...@pc.jaring.my...

> I keep thinking what is the difference between "sprintf" and "wsprintf"
> in terms of usage ?

sprintf is implemented by the C runtime. wsprintfA (aka wsprintf if you're
writing an ANSI application) is implemented in USER32 by Windows. wsprintf
can output a maximum of 1024 characters and can't handle floats or doubles.

Similarly, swprintf is C, whereas wsprintfW (aka wsprintf if you're writing
a Unicode app) is Windows.

--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/


0 new messages