Click here to Skip to main content
15,909,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can we place MFC Controls in RunningObjectTable? Pin
Rajendarmanda20-Sep-13 1:42
Rajendarmanda20-Sep-13 1:42 
GeneralRe: Can we place MFC Controls in RunningObjectTable? Pin
Richard MacCutchan20-Sep-13 1:50
mveRichard MacCutchan20-Sep-13 1:50 
GeneralRe: Can we place MFC Controls in RunningObjectTable? Pin
Rajendarmanda20-Sep-13 2:01
Rajendarmanda20-Sep-13 2:01 
GeneralRe: Can we place MFC Controls in RunningObjectTable? Pin
Richard MacCutchan20-Sep-13 2:18
mveRichard MacCutchan20-Sep-13 2:18 
QuestionWhat is "dialog template resource"? Pin
Vaclav_19-Sep-13 4:55
Vaclav_19-Sep-13 4:55 
AnswerRe: What is "dialog template resource"? Pin
pasztorpisti19-Sep-13 6:32
pasztorpisti19-Sep-13 6:32 
GeneralRe: What is "dialog template resource"? SOLVED Pin
Vaclav_20-Sep-13 4:06
Vaclav_20-Sep-13 4:06 
GeneralRe: What is "dialog template resource"? SOLVED Pin
pasztorpisti20-Sep-13 4:31
pasztorpisti20-Sep-13 4:31 
GeneralRe: What is "dialog template resource"? SOLVED Pin
Vaclav_20-Sep-13 5:46
Vaclav_20-Sep-13 5:46 
Questionhow to registered activex contols Pin
joshikkishore18-Sep-13 7:48
joshikkishore18-Sep-13 7:48 
AnswerRe: how to registered activex contols Pin
Richard Andrew x6418-Sep-13 10:21
professionalRichard Andrew x6418-Sep-13 10:21 
AnswerRe: how to registered activex contols Pin
«_Superman_»18-Sep-13 18:35
professional«_Superman_»18-Sep-13 18:35 
QuestionHow to retrive / enumerate CDialog controls Pin
Vaclav_18-Sep-13 3:49
Vaclav_18-Sep-13 3:49 
AnswerRe: How to retrive / enumerate CDialog controls Pin
pasztorpisti18-Sep-13 4:22
pasztorpisti18-Sep-13 4:22 
GeneralRe: How to retrive / enumerate CDialog controls Pin
Vaclav_18-Sep-13 7:43
Vaclav_18-Sep-13 7:43 
GeneralRe: How to retrive / enumerate CDialog controls Pin
pasztorpisti18-Sep-13 10:58
pasztorpisti18-Sep-13 10:58 
GeneralRe: How to retrive / enumerate CDialog controls Pin
Vaclav_18-Sep-13 12:01
Vaclav_18-Sep-13 12:01 
Questionbytes to mb conversion upto two decimal places. Pin
Le@rner17-Sep-13 18:55
Le@rner17-Sep-13 18:55 
hi all,

I have file size in bytes, I am converting it in MB to display,

but or two decimal places its display round off value.

I don't want to round up the value and value should be displayed in two decimal places.

QWORD nSize=524285686;
static char szSize[16];
	if (nSize < 1024)
	{		
		sprintf(szSize, "%u Byte", nSize);
	}
	else
	{
		char szScales[] = "KMGTPEZY";
		int nScale = 0;
		for (; nScale < sizeof(szScales); ++nScale)
		{
			if (nSize < 1024 * 1024)
			{
				sprintf(szSize, "%6.2f %cB", nSize / 1024.0f, szScales[nScale]);
				break;
			}
			nSize = (nSize + 512) / 1024;
		}
		if (nScale == sizeof(szScales))
		{
			strcpy(szSize, "Unknown Size");
		}
	}
	return szSize;

//its return size=500.00MB
//but in real its = 499.99779319 


thanks in advance.

modified 18-Sep-13 3:18am.

AnswerRe: bytes to mb conversion upto two decimal places. Pin
Richard MacCutchan17-Sep-13 21:06
mveRichard MacCutchan17-Sep-13 21:06 
GeneralRe: bytes to mb conversion upto two decimal places. Pin
Le@rner17-Sep-13 21:27
Le@rner17-Sep-13 21:27 
GeneralRe: bytes to mb conversion upto two decimal places. Pin
Richard MacCutchan17-Sep-13 21:35
mveRichard MacCutchan17-Sep-13 21:35 
GeneralRe: bytes to mb conversion upto two decimal places. Pin
Le@rner17-Sep-13 21:38
Le@rner17-Sep-13 21:38 
AnswerRe: bytes to mb conversion upto two decimal places (fixed). Pin
CPallini17-Sep-13 21:47
mveCPallini17-Sep-13 21:47 
SuggestionRe: bytes to mb conversion upto two decimal places. Pin
pasztorpisti17-Sep-13 23:21
pasztorpisti17-Sep-13 23:21 
GeneralRe: bytes to mb conversion upto two decimal places. Pin
CPallini17-Sep-13 23:32
mveCPallini17-Sep-13 23:32 

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.