cancel
Showing results for 
Search instead for 
Did you mean: 

How to use <stdarg.h> ?

konay61
Associate II
Posted on November 10, 2011 at 08:56

Hi all,

I'm using USART and communicating via rs 232 protocol and trying to send formatted strings by using stdarg.h C library to use;

va_list, va_start, va_arg, va_end..

but I don't know which library is supposed to add.. In some examples somehow some people could use it.. 

Thanks,

#stdarg.h
6 REPLIES 6
Andrew Neil
Evangelist III
Posted on November 12, 2011 at 18:32

Can't you just use printf() or sprintf() ... ?

konay61
Associate II
Posted on November 14, 2011 at 08:41

No, I can't. In order to use these, I guess I'm supposed to add some including .h files or something like that.. 

brunorichard9
Associate II
Posted on November 21, 2011 at 11:44

Hi Onay,

Using printf is generally a good idea. On the Raisonance compiler toolchain, it automatically adapts to your project hence the printf size is very small.

You just need to add #include <stdio.h>, then printf() is available as usual.

Note that printf emits characters on the USART by default, but you can write your own putchar function that fits your needs if it was your choice (looks like it should be OK for you).

Best Regards,

Andrew Neil
Evangelist III
Posted on November 26, 2011 at 17:23

''On the Raisonance compiler toolchain, it automatically adapts to your project hence the printf size is very small.''

When I used Raisonance (which is, admittedly, a few years ago), you had to configure this manually - has that changed, then...?

konay61
Associate II
Posted on November 28, 2011 at 14:20

Thanks Bruno,

I have already found out the solution by the helping of your suggestion..

Best Regards, 

jlchoobs
Associate II
Posted on June 10, 2012 at 14:52

Don't bother worrying about N's negative comments.

He has been doing this all through the forum.

Some kid who likes crittiquing everybody - without giving any actual helpful advice.