-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
26 lines (20 loc) · 886 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
#include <limits.h>
#include "itostr.h"
int main(void)
{
size_t length = 0;
char buffer[80] = { 0 };
length = signedtostr(SIGNEDC(USHRT_MAX), sizeof(short), buffer, sizeof(buffer), 10);
printf("length:%u\tstring:%s\n", (unsigned)length, buffer);
length = unsignedtostr(UNSIGNEDC(SHRT_MIN), sizeof(unsigned short), buffer, sizeof(buffer), 10);
printf("length:%u\tstring:%s\n", (unsigned)length, buffer);
/* OR
wchar_t wbuffer[80] = { 0 };
length = signedtowcs(SIGNEDC(USHRT_MAX), sizeof(unsigned short), wbuffer, sizeof(wbuffer) / sizeof(wbuffer[0]), 10);
wprintf(L"length:%u\tstring:%s\n", (unsigned)length, wbuffer);
length = unsignedtowcs(UNSIGNEDC(SHRT_MIN), sizeof(short), wbuffer, sizeof(wbuffer) / sizeof(wbuffer[0]), 10);
wprintf(L"length:%u\tstring:%s\n", (unsigned)length, wbuffer);
*/
return 0;
}