Forum Discussion
Altera_Forum
Honored Contributor
13 years agosscanf and sprintf
1. Version 13.0 vs 12.1sp1 Recently we try the version 13.0 with our working software in 12.1sp1 but we have a surprise it was not working properly. We have found why, it is because the compi...
Altera_Forum
Honored Contributor
13 years agoUnless some earlier header file has left a pragma (or similar) that packs structures active there should be two bytes of padding between 'Var1' and 'Sub'.
It might be that the printf/scanf implementations aren't processing %hh properly, and that the cut-down versions don't support field widths properly either, also %i isn't standard, use %d. I would use 'unsigned char' on the printf() to avoid the need for %hh. IIRC Altera's printf() brings in about 70k of code, it is possible to write an snprintf() that is much, much smaller and a lot faster. In any case code like: static const char hex = "0123456789abcdef";
buf = hex;
buf = hex;
buf = hex;
...
will be much faster.