Hi Group, I am using IAR version 3.3. Does anybody know how to use snprintf()? I am getting "function declared implicitly" error from the compiler. Also, compiler cannot open xstdio.h. Thanks Uri
snprint()
Started by ●April 19, 2006
Reply by ●April 20, 20062006-04-20
IAR doesn't include that function ... you'll have to provide your own. --- In msp430@msp4..., "Uri Sabadosh" <uri@...> wrote: > > Hi Group, > > I am using IAR version 3.3. Does anybody know how to use snprintf()? > > I am getting "function declared implicitly" error from the compiler. Also, > compiler cannot open xstdio.h. > > Thanks > Uri >
Reply by ●April 20, 20062006-04-20
Hi!
Uri Sabadosh wrote:
> Hi Group,
>
> I am using IAR version 3.3. Does anybody know how to use snprintf()?
>
> I am getting "function declared implicitly" error from the
compiler.
If you are using the DLib library it's included in the library. All you
need to do is to include stdio.h. For example, the following program
will print "Hello".
#include <stdio.h>
int main(void)
{
char buf[10];
/* The following will copy "Hello" and a null character to
"buf". */
snprintf(buf, 6, "Hello, world!");
puts(buf);
}
> Also, compiler cannot open xstdio.h.
Good, that is the way it should be.
This is an internal header file used only when you re-build your
run-time library.
-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.
Reply by ●April 20, 20062006-04-20
Anders, forgive my ignorance, but how does a user provide the low
level hardware drivers to actually get printf to go the that
particular design's UART or LCD or whatever? How do we get your printf
connected to our hardware?
Lloyd
--- In msp430@msp4..., Anders Lindgren <Anders.lindgren@...>
wrote:
> If you are using the DLib library it's
included in the library. All you
> need to do is to include stdio.h. For example, the following program
> will print "Hello".
>
> #include <stdio.h>
>
> int main(void)
> {
> char buf[10];
>
> /* The following will copy "Hello" and a null character to
"buf". */
> snprintf(buf, 6, "Hello, world!");
>
> puts(buf);
> }
>
>
> > Also, compiler cannot open xstdio.h.
>
> Good, that is the way it should be.
>
> This is an internal header file used only when you re-build your
> run-time library.
>
> -- Anders Lindgren, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>
Reply by ●April 21, 20062006-04-21
Anders,
Thanks for the info.
Uri
----- Original Message -----
From: "Anders Lindgren" <Anders.lindgren@Ande...>
To: <msp430@msp4...>
Sent: Thursday, April 20, 2006 1:14 AM
Subject: Re: [msp430] snprint()
> Hi!
>
> Uri Sabadosh wrote:
> > Hi Group,
> >
> > I am using IAR version 3.3. Does anybody know how to use snprintf()?
> >
> > I am getting "function declared implicitly" error from the
compiler.
>
> If you are using the DLib library it's included in the library. All
you
> need to do is to include stdio.h. For example, the following program
> will print "Hello".
>
> #include <stdio.h>
>
> int main(void)
> {
> char buf[10];
>
> /* The following will copy "Hello" and a null character to
"buf". */
> snprintf(buf, 6, "Hello, world!");
>
> puts(buf);
> }
>
>
> > Also, compiler cannot open xstdio.h.
>
> Good, that is the way it should be.
>
> This is an internal header file used only when you re-build your
> run-time library.
>
> -- Anders Lindgren, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
Reply by ●April 24, 20062006-04-24
lslonim2 wrote:
> Anders, forgive my ignorance, but how does a user
provide the low
> level hardware drivers to actually get printf to go the that
> particular design's UART or LCD or whatever? How do we get your printf
> connected to our hardware?
Interesting, this question just popped up in another thread as well, but
it doesn't hurt to answer it twice...
* For the DLib run-time library you can redefine the __write function.
There is a good example implementation in the "write.c" file provided
with IAR EW.
* For the legacy CLib run-time library you have to provide a "puchar"
function.
-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.