#include <conio.h>
#include "general.h"
+#include "vdc_patch_charset.h"
/*
* get_input_terminated_by() reads input (handling backspace correctly) until
return output;
}
+BYTE cgetn_input(char *s, BYTE len) {
+ memset(s, '\0', len);
+ get_input_terminated_by(INPUT_TERMINATOR_RETURN, s, len);
+ return strlen(s);
+}
+
+void cget_return() {
+ BYTE c;
+ while (1) {
+ c = cgetc();
+ if (c == PETSCII_CR) {
+ return;
+ }
+ }
+}
+
char retry_or_quit(void) {
char *c;
do {
}
char *format_euro(char *s, int maxlen, int cent) {
- int tmp = cent;
- int len = strlen(",EUR");
- while ((tmp /= 10) > 0)
- ++len;
- if (len >= maxlen)
+ if (snprintf(s, maxlen, "%3d,%02d" EURSYM, cent / 100, cent % 100) > maxlen)
return NULL;
- // workaround to produce a leading zero for cents.. %0.2d won't work
- sprintf(s, "%3d,%s%dEUR", cent / 100, ((cent % 100) < 10 ? "0" : ""),
- cent % 100);
return s;
}