Click here to Skip to main content
15,890,438 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionReading from a .ini file Pin
jannathali14-Mar-10 21:09
jannathali14-Mar-10 21:09 
AnswerRe: Reading from a .ini file Pin
CPallini14-Mar-10 21:16
mveCPallini14-Mar-10 21:16 
AnswerRe: Reading from a .ini file Pin
SandipG 14-Mar-10 21:39
SandipG 14-Mar-10 21:39 
GeneralRe: Reading from a .ini file Pin
jannathali14-Mar-10 22:09
jannathali14-Mar-10 22:09 
GeneralRe: Reading from a .ini file [modified] Pin
SandipG 14-Mar-10 22:19
SandipG 14-Mar-10 22:19 
GeneralRe: Reading from a .ini file Pin
ThatsAlok15-Mar-10 1:50
ThatsAlok15-Mar-10 1:50 
AnswerRe: Reading from a .ini file Pin
Iain Clarke, Warrior Programmer14-Mar-10 22:30
Iain Clarke, Warrior Programmer14-Mar-10 22:30 
QuestionPlease chk there is some mistake? Pin
Le@rner14-Mar-10 19:48
Le@rner14-Mar-10 19:48 
Hi all,

i create this code for some conversion but i dont know waht is the mistake is present dere,
loop is not return,

please chk this code.

//here i pass

Value=72;
digits=7;

CString PDU::Bin(int Value, short digits)
{
	CString Bin;
	//#define def_Bin
//#ifdef def_Bin

	CString result; 
	short exponent=0;
     // this is faster than creating the string by appending chars
     result = CString("0"[0],32);
	 do{
		 if (Value & Power2(exponent)) {
             // we found a bit that is set, clear it
             result.Mid(32 - exponent-1, 1);
             Value = Value ^ Power2(exponent);
		 }
         exponent += 1;
	 } while (Value);
	 if (digits < 0) {
         // trim non significant digits, if digits was omitted or negative
         Bin = result.Mid(33 - exponent-1);
	 } else {
         // else trim to the requested number of digits
         Bin = result.Right(digits);
	 }

//#endif // def_Bin

	return Bin;

}
int PDU::Power2(int exponent)
{
	int Power2=0;

//#define def_Power2
//#ifdef def_Power2

	 static int res[31+1];
     int I;

     // rule out errors
     if( exponent < 0 || exponent > 31) /*throw(5);*/
		 //AfxMessageBox("Invalid");

     // initialize the array at the first call
	 if(res[0] = 0) {
         res[0] = 1;
		 for(I = 1;I<30;I++) {
             res[I] = res[I - 1] * 2;
		 }
         // this is a special case
         res[31] = 0x80000000;
	 }

     // return the result
     Power2 = res[exponent];

//#endif // def_Power2


	return Power2;

}


please help me.
AnswerRe: Please chk there is some mistake? Pin
Eugen Podsypalnikov14-Mar-10 20:54
Eugen Podsypalnikov14-Mar-10 20:54 
QuestionRe: Please chk there is some mistake? Pin
CPallini14-Mar-10 21:54
mveCPallini14-Mar-10 21:54 
JokeRe: Please chk there is some mistake? Pin
ThatsAlok15-Mar-10 1:48
ThatsAlok15-Mar-10 1:48 
JokeRe: Please chk there is some mistake? Pin
CPallini15-Mar-10 1:57
mveCPallini15-Mar-10 1:57 
GeneralRe: Please chk there is some mistake? Pin
Tim Craig15-Mar-10 8:48
Tim Craig15-Mar-10 8:48 
QuestionRe: Please chk there is some mistake? Pin
David Crow15-Mar-10 2:55
David Crow15-Mar-10 2:55 
Questionpublic/private key pair and digital certificate Pin
Varghese Paul M14-Mar-10 18:10
Varghese Paul M14-Mar-10 18:10 
AnswerRe: public/private key pair and digital certificate Pin
BIJU Manjeri15-Mar-10 3:10
BIJU Manjeri15-Mar-10 3:10 
QuestionBreak CString into several strings? Pin
Omar El Fata14-Mar-10 15:45
Omar El Fata14-Mar-10 15:45 
AnswerRe: Break CString into several strings? Pin
Vaclav_14-Mar-10 16:40
Vaclav_14-Mar-10 16:40 
AnswerRe: Break CString into several strings? Pin
«_Superman_»14-Mar-10 16:40
professional«_Superman_»14-Mar-10 16:40 
AnswerRe: Break CString into several strings? Pin
Shivanand Gupta14-Mar-10 20:37
Shivanand Gupta14-Mar-10 20:37 
GeneralRe: Break CString into several strings? Pin
ThatsAlok15-Mar-10 1:46
ThatsAlok15-Mar-10 1:46 
GeneralRe: Break CString into several strings? Pin
Omar El Fata15-Mar-10 3:11
Omar El Fata15-Mar-10 3:11 
GeneralRe: Break CString into several strings? Pin
Omar El Fata15-Mar-10 3:25
Omar El Fata15-Mar-10 3:25 
QuestionRe: Break CString into several strings? Pin
David Crow15-Mar-10 7:42
David Crow15-Mar-10 7:42 
AnswerRe: Break CString into several strings? Pin
Omar El Fata15-Mar-10 14:32
Omar El Fata15-Mar-10 14: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.