Click here to Skip to main content
15,917,645 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralVisual C++ MFC on Mac (OS 9 and X) Pin
Harlan Seymour13-Jul-02 13:11
Harlan Seymour13-Jul-02 13:11 
GeneralRe: Visual C++ MFC on Mac (OS 9 and X) Pin
Michael P Butler13-Jul-02 23:15
Michael P Butler13-Jul-02 23:15 
Questionhow to present an application's icon in system tray Pin
Nauman Ghazi13-Jul-02 10:26
Nauman Ghazi13-Jul-02 10:26 
AnswerRe: how to present an application's icon in system tray Pin
Nish Nishant13-Jul-02 16:50
sitebuilderNish Nishant13-Jul-02 16:50 
GeneralSaving out a Binary Text File Pin
John Aldrich13-Jul-02 9:07
John Aldrich13-Jul-02 9:07 
GeneralRe: Saving out a Binary Text File Pin
Ancient Dragon14-Jul-02 2:09
Ancient Dragon14-Jul-02 2:09 
GeneralRe: Saving out a Binary Text File Pin
John Aldrich14-Jul-02 6:47
John Aldrich14-Jul-02 6:47 
GeneralRe: Saving out a Binary Text File Pin
Ancient Dragon14-Jul-02 22:39
Ancient Dragon14-Jul-02 22:39 
There are at least two ways I know of to convert a number to its binary value, like the windows calculator does.

(1) Set up a bit structure and access each of its members just like any other structure.

typedef union
{
struct bits
{
unsigned short bit1:1;
unsigned short bit2:1;
// etc.
} bits;
unsigned short theNumber;
}BITS;

BITS b.theNumber = 365;

int bit1 = b.bits.bit1;



(2) A much more efficient way is to compute the bit pattern using the >> operator. If you look at the assembly code produced by the compiler from the method shown above, you will see that it actually uses the right shift operator to get the value out of the structure.

int x = 365;
for(int i = 1; i <= 16; i++)
{
int n = (x >> i) & 1;
printf("%d\n", n);
}
GeneralRe: Saving out a Binary Text File Pin
Mike Nordell15-Jul-02 6:25
Mike Nordell15-Jul-02 6:25 
GeneralRe: Saving out a Binary Text File Pin
John Aldrich15-Jul-02 9:11
John Aldrich15-Jul-02 9:11 
GeneralRe: Saving out a Binary Text File Pin
Mike Nordell16-Jul-02 8:04
Mike Nordell16-Jul-02 8:04 
GeneralCFile and Linefeed Pin
ColinDavies13-Jul-02 7:21
ColinDavies13-Jul-02 7:21 
GeneralRe: CFile and Linefeed Pin
Jay Beckert13-Jul-02 7:25
Jay Beckert13-Jul-02 7:25 
GeneralRe: CFile and Linefeed Pin
Jay Beckert13-Jul-02 7:45
Jay Beckert13-Jul-02 7:45 
GeneralRe: CFile and Linefeed Pin
ColinDavies13-Jul-02 13:34
ColinDavies13-Jul-02 13:34 
GeneralRe: CFile and Linefeed Pin
Michael Dunn13-Jul-02 13:14
sitebuilderMichael Dunn13-Jul-02 13:14 
GeneralRe: CFile and Linefeed Pin
ColinDavies13-Jul-02 13:21
ColinDavies13-Jul-02 13:21 
Generalcrash if I try to save CRect left-very bizarre Pin
ns13-Jul-02 6:40
ns13-Jul-02 6:40 
GeneralRe: crash if I try to save CRect left-very bizarre Pin
Ernest Laurentin13-Jul-02 7:36
Ernest Laurentin13-Jul-02 7:36 
GeneralRe: crash if I try to add a member variable!!! Pin
ns14-Jul-02 2:01
ns14-Jul-02 2:01 
GeneralRe: crash Problem SOlved!! Pin
ns14-Jul-02 2:22
ns14-Jul-02 2:22 
GeneralRe: crash Problem SOlved!! Pin
Ernest Laurentin14-Jul-02 7:23
Ernest Laurentin14-Jul-02 7:23 
QuestionHow to access drived CArray structure Pin
chen13-Jul-02 6:09
chen13-Jul-02 6:09 
AnswerRe: How to access drived CArray structure Pin
Christian Graus13-Jul-02 12:51
protectorChristian Graus13-Jul-02 12:51 
GeneralRe: How to access drived CArray structure Pin
chen13-Jul-02 15:00
chen13-Jul-02 15:00 

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.