Hi Nick,

The declaration of sprintf in BoilerPlate is a relic of code that was never
actually used in the app, and so is not needed. I'll remove the sprintf
declaration it in the next update.

sprintf is occasionally used to create a string in a desired format,
dependent on variables in the code (and so cannot be hard coded). See
JustFATLoggingP.nc for an example of this being used.

There is a method of using printf in TinyOS that writes the string to the
serial port. As Phil says there is documentation on the TinyOS wiki about
this. However the wiki currently seems to be experiencing some problems and
page of interest is blank. Instead for now you can take a look at
tinyos-main/apps/tutorials/Printf (
http://code.google.com/p/tinyos-main/source/browse/#svn%2Ftrunk%2Fapps%2Ftutorials%2FPrintf).


There is also a TestPrintf app in tinyos-main/apps/tests but this does not
currently work as it was not updated to reflect fairly recent changes to how
printf works in TinyOS.

Mike

On Tue, May 31, 2011 at 10:16 PM, Nicholas Hosein <[email protected]>wrote:

> I noticed in the Boiler plate app there is the line:
>
> extern int sprintf(char *str, const char *format, ...) __attribute__ ((C));
>
> Is this a way to use printf statements in the code? If so how?
>
> Best,
>
> Nick
>
> _______________________________________________
> Shimmer-users mailing list
> [email protected]
> https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users
>
>
_______________________________________________
Shimmer-users mailing list
[email protected]
https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users

Reply via email to