PCD8544 multiscreen

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stringman.h Source File

stringman.h

00001 void itostr(char* buffer, int v) {
00002    char temp[3];
00003   
00004    //temp="";
00005    
00006     if (v>99999) {
00007 
00008         snprintf(buffer,4,"%3i",v);
00009     } else
00010 
00011         if (v>9999) {
00012             snprintf(buffer,4,"%3i",v);
00013              snprintf(temp,2,"k");
00014              buffer[3] = temp[1];
00015             
00016         } else
00017 
00018             if (v>999) {
00019                 
00020                 snprintf(buffer,4,"%3i",v);
00021                 buffer[3] = buffer[2];
00022                 snprintf(temp,2,"k");
00023                 buffer[2] = temp[1];
00024             } else
00025                 if (v>99) {
00026                     snprintf(buffer,4,"%3i",v);
00027 
00028                 } else
00029                     if (v>9) {
00030                         snprintf(buffer,4,"%3i",v);
00031 
00032                     } else {
00033                         snprintf(buffer,4,"%3i",v);
00034 
00035                     }
00036 
00037 }