Click here to Skip to main content
15,892,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How To Trap esc key code for Dailog Application Pin
Rajesh R Subramanian19-May-06 21:17
professionalRajesh R Subramanian19-May-06 21:17 
Questionl don't know how to use iocp? please tell me how to do? Pin
YuxiLv19-May-06 16:44
YuxiLv19-May-06 16:44 
AnswerRe: l don't know how to use iocp? please tell me how to do? Pin
Nibu babu thomas19-May-06 19:37
Nibu babu thomas19-May-06 19:37 
Answerl am sorry! Pin
YuxiLv20-May-06 1:16
YuxiLv20-May-06 1:16 
QuestionHow to read parllel port Pin
mbkh_8419-May-06 15:56
mbkh_8419-May-06 15:56 
AnswerRe: How to read parllel port Pin
kk.tvm19-May-06 20:52
kk.tvm19-May-06 20:52 
GeneralRe: How to read parllel port Pin
Hamid_RT20-May-06 1:02
Hamid_RT20-May-06 1:02 
QuestionRounding up to a multiple of a number Pin
Remco Hoogenboezem19-May-06 11:03
Remco Hoogenboezem19-May-06 11:03 
I would like to round a LONG to a multiple of an other LONG. For example: I have got the number 5 and i would like to round it up to a multiple of 3. I wrote the following code to do this:

lCurrent=((lMinimum+(lIncrement-1))/lIncrement)*lIncrement;

In this piece of code lMinimum is de value that gets rounded up. And lIncrement is the value to wich lMinimum is rounded up. So if we choose the numbers mentioned above we get 6. This works fine for positive numbers but when we choose a negative number for lMinimum it goes wrong. I wrote another piece of code to handle negative numbers

lCurrent=abs(lMinimum%lIncrement)+lMinimum;

So combining the two we get:

if(lMinimum>=0)
{
lCurrent=((lMinimum+(lIncrement-1))/lIncrement)*lIncrement;
}

else
{
lCurrent=abs(lMinimum%lIncrement)+lMinimum;
}

This is the obvious way and it contains one conditional branch. I was wondering of someone came accros a bit twiddling hack to do this more efficient.

Thanks Wink | ;)
AnswerRe: Rounding up to a multiple of a number Pin
Nibu babu thomas19-May-06 18:50
Nibu babu thomas19-May-06 18:50 
AnswerRe: Rounding up to a multiple of a number Pin
Laxman Auti19-May-06 19:11
Laxman Auti19-May-06 19:11 
QuestionProblem with Linked List Pin
CoffeeAddict1919-May-06 9:49
CoffeeAddict1919-May-06 9:49 
AnswerRe: Problem with Linked List Pin
led mike19-May-06 11:22
led mike19-May-06 11:22 
AnswerRe: Problem with Linked List Pin
_AnsHUMAN_ 19-May-06 18:33
_AnsHUMAN_ 19-May-06 18:33 
AnswerRe: Problem with Linked List Pin
Laxman Auti19-May-06 19:45
Laxman Auti19-May-06 19:45 
Questiontabstop Pin
sandem19-May-06 9:44
sandem19-May-06 9:44 
AnswerRe: tabstop Pin
Steve Echols19-May-06 19:34
Steve Echols19-May-06 19:34 
GeneralRe: tabstop Pin
sandem22-May-06 3:45
sandem22-May-06 3:45 
QuestionCView doesn't respond to PostMessage Pin
masnu19-May-06 9:26
masnu19-May-06 9:26 
AnswerRe: CView doesn't respond to PostMessage Pin
Mauro Leggieri19-May-06 9:41
Mauro Leggieri19-May-06 9:41 
AnswerRe: CView doesn't respond to PostMessage Pin
led mike19-May-06 11:17
led mike19-May-06 11:17 
AnswerRe: CView doesn't respond to PostMessage Pin
Nibu babu thomas19-May-06 18:47
Nibu babu thomas19-May-06 18:47 
QuestionIterators in forms Pin
mgodsey19-May-06 8:15
mgodsey19-May-06 8:15 
AnswerRe: Iterators in forms Pin
led mike19-May-06 8:56
led mike19-May-06 8:56 
GeneralRe: Iterators in forms Pin
mgodsey19-May-06 10:26
mgodsey19-May-06 10:26 
Questionget HiByte [modifed] Pin
big_denny_20019-May-06 7:59
big_denny_20019-May-06 7:59 

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.