Click here to Skip to main content
15,891,777 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralToolbar.bmp 256 colors not displaying Pin
JoeSox15-Mar-03 9:21
JoeSox15-Mar-03 9:21 
GeneralRe: Toolbar.bmp 256 colors not displaying Pin
MAAK15-Mar-03 10:48
MAAK15-Mar-03 10:48 
GeneralRe: Toolbar.bmp 256 colors not displaying Pin
JoeSox15-Mar-03 11:04
JoeSox15-Mar-03 11:04 
GeneralClass string Manipulators Pin
Makover15-Mar-03 9:19
Makover15-Mar-03 9:19 
GeneralRe: Class string Manipulators Pin
Abbas_Riazi16-Mar-03 2:48
professionalAbbas_Riazi16-Mar-03 2:48 
QuestionHow do I set the first 10 BITS of 4 chars string to a letter?? Pin
IrishSonic15-Mar-03 8:48
IrishSonic15-Mar-03 8:48 
AnswerRe: How do I set the first 10 BITS of 4 chars string to a letter?? Pin
Nish Nishant15-Mar-03 9:26
sitebuilderNish Nishant15-Mar-03 9:26 
AnswerRe: How do I set the first 10 BITS of 4 chars string to a letter?? Pin
moliate15-Mar-03 11:09
moliate15-Mar-03 11:09 
As stated above a char is 8 bytes. You are trying to use 10 out of 8 bits.
Below is an alternative (actually 3-in-one):
struct s_Person
{
	union
	{
		char A[4];

		struct
		{
		char a;
		char b;
		char c;
		char d;
		};

		unsigned int name;
	};
};


If you want to set the string to "ABCD", you could use:
s_Person p;
p.a = 'A'; 
p.b = 'B'; 
p.c = 'C'; 
p.d = 'D';
// or ...
p.A[0] = 'A'; 
p.A[1] = 'B'; 
p.A[2] = 'C'; 
p.A[3] = 'D';
// or ...
p.name = 'DCBA'; 

The last one might look odd, but the byte order is because Intel has a little-endian architecture.

Anyway, the total size of the structure is 32 bits.

/moliate



The corners of my eyes catch hasty, bloodless motion -
a mouse?
Well, certainly a peripheral of some kind.

Neil Gaiman - Cold Colours


AnswerRe: How do I set the first 10 BITS of 4 chars string to a letter?? Pin
Abbas_Riazi16-Mar-03 3:24
professionalAbbas_Riazi16-Mar-03 3:24 
GeneralRe: How do I set the first 10 BITS of 4 chars string to a letter?? Pin
IrishSonic16-Mar-03 5:03
IrishSonic16-Mar-03 5:03 
GeneralRe: How do I set the first 10 BITS of 4 chars string to a letter?? Pin
Abbas_Riazi16-Mar-03 6:53
professionalAbbas_Riazi16-Mar-03 6:53 
AnswerRe: How do I set the first 10 BITS of 4 chars string to a letter?? Pin
Jambolo16-Mar-03 14:27
Jambolo16-Mar-03 14:27 
QuestionApplication Version standard?? Pin
work_to_live15-Mar-03 7:39
work_to_live15-Mar-03 7:39 
AnswerRe: Application Version standard?? Pin
Anders Molin15-Mar-03 7:52
professionalAnders Molin15-Mar-03 7:52 
AnswerRe: Application Version standard?? Pin
Chris Losinger15-Mar-03 8:23
professionalChris Losinger15-Mar-03 8:23 
GeneralRe: Application Version standard?? Pin
r i s h a b h s16-Mar-03 17:42
r i s h a b h s16-Mar-03 17:42 
GeneralRe: Application Version standard?? Pin
work_to_live19-Mar-03 4:56
work_to_live19-Mar-03 4:56 
AnswerRe: Application Version standard?? Pin
moliate15-Mar-03 8:38
moliate15-Mar-03 8:38 
GeneralDirectX Pin
wanju15-Mar-03 7:19
wanju15-Mar-03 7:19 
GeneralRe: DirectX Pin
Stephane Rodriguez.15-Mar-03 7:33
Stephane Rodriguez.15-Mar-03 7:33 
GeneralUsing CHtmlView w/o a doc Pin
Matt Gates15-Mar-03 7:00
Matt Gates15-Mar-03 7:00 
GeneralRe: Using CHtmlView w/o a doc Pin
Stephane Rodriguez.15-Mar-03 7:31
Stephane Rodriguez.15-Mar-03 7:31 
GeneralRe: Using CHtmlView w/o a doc Pin
Matt Gates15-Mar-03 15:14
Matt Gates15-Mar-03 15:14 
GeneralCListCtrl Pin
dudic15-Mar-03 6:34
dudic15-Mar-03 6:34 
GeneralRe: CListCtrl Pin
RobJones15-Mar-03 6:40
RobJones15-Mar-03 6:40 

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.