diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/example2.c b/examples/example2.c index 13c280e..f8b085c 100644 --- a/examples/example2.c +++ b/examples/example2.c @@ -65,14 +65,17 @@ int main(int argc, char *argv[]) { if (strlen(buf)<2) break; rccstring = rccFrom(NULL, 0, buf); + if (!rccstring) rccstring = strdup(buf); + if (rccstring) { recoded = rccTo(NULL, 1, rccstring); + if (!recoded) recoded = strdup(rccstring); if (recoded) { printf("%s", recoded); free(recoded); - } else printf("Recoding from UTF-8 is failed\n"); + } free(rccstring); - } else printf("Recoding to UTF-8 is failed\n"); + } } rccFree(); |