]> git.sur5r.net Git - c128-kasse/commitdiff
format_euro now produces a leading zero for cents
authormatze <matze@af93e077-1a23-4f1e-9cbe-9382a9d578f5>
Thu, 25 Oct 2007 00:17:33 +0000 (00:17 +0000)
committermatze <matze@af93e077-1a23-4f1e-9cbe-9382a9d578f5>
Thu, 25 Oct 2007 00:17:33 +0000 (00:17 +0000)
git-svn-id: https://shell.noname-ev.de/svn/kasse/c128@57 af93e077-1a23-4f1e-9cbe-9382a9d578f5

src/general.c

index 82a04f67dfced1b48f8ffcb0932c4f6c456bb683..74d57b1a4ecd31cd4454f95d862fd5ff79d7b794 100644 (file)
@@ -12,7 +12,7 @@
 #include "general.h"
 
 /*
- * Liest (maximal 31) Zeichen ein, bis Enter gedrückt wird.
+ * Liest (maximal 31) Zeichen ein, bis Enter gedrckt wird.
  * Vorsicht: Es wird ein statischer Buffer benutzt, sodass man
  * das Ergebnis via strdup() retten muss, bevor man get_input()
  * erneut aufruft
@@ -41,7 +41,8 @@ char *format_euro(char *s, int maxlen, int cent){
                ++len;
        if (len >= maxlen)
                return NULL;
-       sprintf(s, "%d,%dEUR", cent / 100, cent % 100);
+       // workaround to produce a leading zero for cents.. %0.2d won't work 
+       sprintf(s, "%d,%s%dEUR", cent / 100, (cent<10?"0":""), cent % 100);
        return s;
 }