Commit 6966a81b authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Create i64toac() to generate comma-separated ASCII string of 64-bit int

parent 1bea8247
...@@ -495,6 +495,23 @@ char* ultoac(ulong l, char *string) ...@@ -495,6 +495,23 @@ char* ultoac(ulong l, char *string)
return(string); return(string);
} }
char* i64toac(int64_t l, char *string)
{
char str[256];
int i,j,k;
_i64toa(l,str,10);
i=strlen(str)-1;
j=i/3+1+i;
string[j--]=0;
for(k=1;i>-1;k++) {
string[j--]=str[i--];
if(j>0 && !(k%3))
string[j--]=',';
}
return string;
}
/****************************************************************************/ /****************************************************************************/
/* Truncate string at first occurrence of char in specified character set */ /* Truncate string at first occurrence of char in specified character set */
/* Returns a pointer to the terminating NUL if the string was truncated, */ /* Returns a pointer to the terminating NUL if the string was truncated, */
......
...@@ -64,6 +64,7 @@ DLLEXPORT BOOL valid_ctrl_a_attr(char a); ...@@ -64,6 +64,7 @@ DLLEXPORT BOOL valid_ctrl_a_attr(char a);
DLLEXPORT BOOL valid_ctrl_a_code(char a); DLLEXPORT BOOL valid_ctrl_a_code(char a);
DLLEXPORT size_t strip_invalid_attr(char *str); DLLEXPORT size_t strip_invalid_attr(char *str);
DLLEXPORT char * ultoac(ulong l,char *str); DLLEXPORT char * ultoac(ulong l,char *str);
DLLEXPORT char * i64toac(int64_t, char *str);
DLLEXPORT char * rot13(char* str); DLLEXPORT char * rot13(char* str);
DLLEXPORT uint32_t str_to_bits(uint32_t currval, const char *str); DLLEXPORT uint32_t str_to_bits(uint32_t currval, const char *str);
DLLEXPORT BOOL str_has_ctrl(const char*); DLLEXPORT BOOL str_has_ctrl(const char*);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment