mirror of https://github.com/cy384/ssheven.git
add quick simple integer print function
This commit is contained in:
parent
d8b7b26f17
commit
3c72511444
|
@ -107,6 +107,22 @@ void print_char(char c)
|
|||
}
|
||||
}
|
||||
|
||||
void print_int(int d)
|
||||
{
|
||||
char itoc[] = {'0','1','2','3','4','5','6','7','8','9'};
|
||||
|
||||
char buffer[12] = {0};
|
||||
int i = 10;
|
||||
|
||||
for (; d > 0; i--)
|
||||
{
|
||||
buffer[i] = itoc[d % 10];
|
||||
d /= 10;
|
||||
}
|
||||
|
||||
print_string(buffer+i+1);
|
||||
}
|
||||
|
||||
void print_string_i(const char* c)
|
||||
{
|
||||
print_string(c);
|
||||
|
|
|
@ -22,6 +22,7 @@ int is_printable(char c);
|
|||
void print_char(char c);
|
||||
void print_string(const char* c);
|
||||
void print_string_i(const char* c);
|
||||
void print_int(int d);
|
||||
|
||||
void set_window_title(WindowPtr w, const char* c_name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue