| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Digit Mask

This version was saved 15 years, 7 months ago View current version     Page history
Saved by Kenneth Finnegan
on August 29, 2008 at 1:03:20 am
 

The original usage for this macro was for converting integers to a string, which is better served by sprintf, but there may be other uses for it. 

 

Code:

 

IS BROKEN!!!

#define MASKDIGIT(digitnum, n)  (n/pow(10, digitnum) - (n/pow(10,digitnum+1)*10))

 

Usage:

This macro could be used if you're expecting to return multiple single digit numbers from a function.

 

 


Extensions:

 


Sources:

http://codingexperiments.com/archives/324

Comments (0)

You don't have permission to comment on this page.