Brian,
I thought that Dave was responding to Sreenivas' comments more than he was
responding to anyone else's. Sreenivas' comments make it sound like
StdIOPalm.h eliminates all your problems by defining sprintf as StrPrintF.
As nearly everyone else has pointed out, they are not exactly the same, but
StrPrintF is what the Palm OS provides, so use it if it can do what you
need. It makes no sense whatsoever to include StdIOPalm.h just so you can
hide the fact that you are actually calling StrPrintF when you invoke
sprintf. In fact, all that does is increase the likelihood of programming
errors.
> -----Original Message-----
> From: Brian Smith
>
> I don't recall anyone talking about compatibility - the original question
> asked about using sprintf, and several people suggested using StrPrintF
> *instead*, with the appropriate cautions about reading the
> documentation for
> StrPrintF, because it's not exactly the same as sprintf. I think it's safe
> to assume that the person wanted to accomplish a specific result with
> sprintf, and if that same result can be accomplished with
> StrPrintF, that's
> a better solution.
>
> I don't see why that advice would be confusing...
>
> Brian
>
> > -----Original Message-----
> > From: Dave Lippincott
> >
> > But sprintf is not compatible with StrPrintF as Palm has
> > written it. Even
> > if the header redefines sprintf as StrPrintF, StrPrintF
> > cannot handle the
> > same format specifiers as sprintf. Giving the suggestion
> > that sprintf is
> > supported in the Palm OS will also give the impression that
> > the function is
> > complete and possibly cause problems later when they try
> > something like
> > formatting a floating point variable.
> > Why confuse people? If we are going to give advice to other
> > programmers,
> > lets give them what will work for all situations. And not
> > give advice that
> > will work in *most* cases.
> >
> > ----- Original Message -----
> > From: "Sreenivas Reddy"
> > >
> > > Hi all,
> > >
> > > You can use the C calls like sprintf(). But you need to
> > include the header
> > > file "StdIOPalm.h".
> > > In the header file I mentioned just now it is defined like
> > this... (for
> > > Example)
> > >
> > > #define sprintf StrPrintF
> > >
> > > What this does is if you call sprintf() then (If the header file is
> > > included)
> > > OS automatically replaces sprintf() with StrPrintF.
> > > So if we want we can use C Calls, but OS internally
> > replaces them by the
> > > equivalent.
> > >
> > > Thanks,
> > > Sreenivas Reddy
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/