]> git.sur5r.net Git - c128-kasse/blobdiff - src/general.c
Check if read < 0
[c128-kasse] / src / general.c
index 82a04f67dfced1b48f8ffcb0932c4f6c456bb683..8a9041d9b66905b8c406d89c9b5493d2cf5a600e 100644 (file)
@@ -1,6 +1,6 @@
 /* 
  * RGB2R-C128-Kassenprogramm
- * (c) 2007 phil_fry, sECuRE, sur5r
+ * (c) 2007-2008 phil_fry, sECuRE, sur5r
  * See LICENSE for license information
  *
  */
@@ -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%100)<10?"0":""), cent % 100);
        return s;
 }