Click here to Skip to main content
16,008,075 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about MouseProc Pin
Maer7273-Nov-01 19:52
Maer7273-Nov-01 19:52 
QuestionHow can Pin
2-Nov-01 1:15
suss2-Nov-01 1:15 
Generalformatting number to kb Pin
Xenion2-Nov-01 0:20
Xenion2-Nov-01 0:20 
GeneralRe: formatting number to kb Pin
Nish Nishant2-Nov-01 0:36
sitebuilderNish Nishant2-Nov-01 0:36 
GeneralRe: formatting number to kb Pin
markkuk2-Nov-01 2:01
markkuk2-Nov-01 2:01 
GeneralRe: formatting number to kb Pin
Michael Dunn2-Nov-01 1:55
sitebuilderMichael Dunn2-Nov-01 1:55 
GeneralRe: formatting number to kb Pin
Nish Nishant2-Nov-01 4:01
sitebuilderNish Nishant2-Nov-01 4:01 
GeneralRe: formatting number to kb Pin
Xenion2-Nov-01 2:12
Xenion2-Nov-01 2:12 
Thanks for the feedback so far,

Came up with the following, how does this look?
any input, comment welcome...

//----------------------------------------------------------------

#include "string.h"

char szOutput[20];

char* formatKB(long input)
{
char szInput[20];
int j=0, k=0;

sprintf( szInput, "%d", input);
_strrev(szInput);
for (int i = 0; i < strlen(szInput); i +=3)
{
strncpy( szOutput + k, szInput + j, 3);
if (j < strlen(szInput) - 3 )
strcat( szOutput , ".");
j+=3;
k+=4;
}
_strrev(szOutput);
return szOutput;
}

int main(int argc, char* argv[])
{
long sizeWritten = 1234567890;
printf("%s Kb\n", formatKB(sizeWritten));
return 0;
}

//----------------------------------------------------------------

Xenion
GeneralFile validation on a server Pin
Ashman1-Nov-01 23:29
Ashman1-Nov-01 23:29 
GeneralRe: File validation on a server Pin
Rassman2-Nov-01 2:01
Rassman2-Nov-01 2:01 
GeneralSimple question about TLS Pin
Maer7271-Nov-01 22:31
Maer7271-Nov-01 22:31 
GeneralRe: Simple question about TLS Pin
James R. Twine2-Nov-01 3:25
James R. Twine2-Nov-01 3:25 
GeneralRe: Simple question about TLS Pin
Maer7272-Nov-01 19:17
Maer7272-Nov-01 19:17 
GeneralStore window size and position Pin
1-Nov-01 22:13
suss1-Nov-01 22:13 
GeneralRe: Store window size and position Pin
Jon Hulatt1-Nov-01 22:14
Jon Hulatt1-Nov-01 22:14 
GeneralRe: Store window size and position Pin
Nish Nishant1-Nov-01 22:22
sitebuilderNish Nishant1-Nov-01 22:22 
GeneralRe: Store window size and position Pin
Nish Nishant1-Nov-01 22:22
sitebuilderNish Nishant1-Nov-01 22:22 
GeneralRe: Store window size and position Pin
1-Nov-01 22:33
suss1-Nov-01 22:33 
GeneralRe: Store window size and position Pin
Jon Hulatt1-Nov-01 22:57
Jon Hulatt1-Nov-01 22:57 
Generalfocus to button Pin
peterchen1-Nov-01 22:12
peterchen1-Nov-01 22:12 
GeneralRe: focus to button Pin
Nish Nishant1-Nov-01 22:17
sitebuilderNish Nishant1-Nov-01 22:17 
GeneralRe: focus to button Pin
peterchen1-Nov-01 22:34
peterchen1-Nov-01 22:34 
GeneralRe: focus to button Pin
Nish Nishant1-Nov-01 23:06
sitebuilderNish Nishant1-Nov-01 23:06 
GeneralRe: focus to button Pin
peterchen6-Nov-01 11:31
peterchen6-Nov-01 11:31 
GeneralCTabCtrl in CRecordView Pin
Statbat1-Nov-01 21:12
Statbat1-Nov-01 21:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.