Click here to Skip to main content
15,900,973 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Thanks Pin
Christian Graus27-Dec-01 14:53
protectorChristian Graus27-Dec-01 14:53 
GeneralRe: Thanks Pin
Tim Smith27-Dec-01 15:18
Tim Smith27-Dec-01 15:18 
GeneralRe: Win XP Pin
Alvaro Mendez27-Dec-01 10:10
Alvaro Mendez27-Dec-01 10:10 
GeneralRe: Win XP Pin
Ravi Bhavnani27-Dec-01 10:43
professionalRavi Bhavnani27-Dec-01 10:43 
GeneralRe: Win XP Pin
Alvaro Mendez27-Dec-01 11:30
Alvaro Mendez27-Dec-01 11:30 
GeneralBeta 2 Or Release Candidate Pin
vinuk27-Dec-01 6:31
vinuk27-Dec-01 6:31 
GeneralRe: Beta 2 Or Release Candidate Pin
Christian Graus27-Dec-01 14:54
protectorChristian Graus27-Dec-01 14:54 
GeneralBitwise operators, static cast and Position pointers Pin
27-Dec-01 6:26
suss27-Dec-01 6:26 
I have used this code to create a CStringList linked list, once a pointer to a string in the list is found, it is changed into 4- 8bit characters, then back again... however this results in a lack of accuracy. Please help (if u run the code as it is ur likelly to get a first chance exception).



POSITION pos,poss;

char letter;
UINT a,b,c,d;
UINT p;
CStringList strl; /// create CStringlist
strl.AddTail("Line One"); /// Add a few lines
strl.AddTail("Beer Number 2 please");
pos=strl.GetHeadPosition(); /// get pointer to head position of list


p=(UINT)pos;

printf ("%s\n",strl.GetAt(pos)); /// get pointer to position of line one

/// get position pointer as a UINT

printf("p= %d\n",p); /// output position as UINT

a=p>>24; // get last 8 bits
printf("a=%d",a);

letter=(static_cast<unsigned int>(a)); /// convert to 8bit char
a=(static_cast<char>(letter)); /// convert back to UINT
printf(" %d\n",a);
a=a<<24;


b=p<<8;
b=b>>24; // get 2nd to last set of 8 bits
printf("b=%d",b);
letter=(static_cast<unsigned int>(b)); /// convert to 8bit char
b=(static_cast<char>(letter)); /// convert back to UINT
printf(" %d\n",b);
b=b<<16;


c=p<<16;
c=c>>24; // get 3rd to last set of 8 bits
printf("c=%d",c);
letter=(static_cast<unsigned int>(c)); /// convert to 8bit char
c=(static_cast<char>(letter)); /// convert back to UINT
printf(" %d\n",c);
c=c<<8;


d=p<<24;
d=p>>24; // get first set of 8 bits
printf("d=%d ",d);
letter=(static_cast<unsigned int>(d)); /// convert to 8bit char
d=(static_cast<char>(letter)); /// convert back to UINT

printf("%d\n",d);

p=(UINT)a|b|c|d; // use or to add the sets of 8 bits together

printf("p with or =%d\n",p); // display p using or (these values should be the same as
printf("p with + =%d\n",a+b+c+d); // display p using + the intitial p)

poss=(POSITION)p;
getch();
printf ("%s",strl.GetAt(poss));
getch();
}
GeneralRe: Bitwise operators, static cast and Position pointers Pin
Michael Dunn27-Dec-01 7:10
sitebuilderMichael Dunn27-Dec-01 7:10 
GeneralRe: Bitwise operators, static cast and Position pointers Pin
27-Dec-01 7:40
suss27-Dec-01 7:40 
GeneralRe: Bitwise operators, static cast and Position pointers Pin
Tim Smith27-Dec-01 7:46
Tim Smith27-Dec-01 7:46 
GeneralRe: Bitwise operators, static cast and Position pointers Pin
27-Dec-01 12:19
suss27-Dec-01 12:19 
GeneralRAS...I don't get him! Pin
BlackSmith27-Dec-01 6:02
BlackSmith27-Dec-01 6:02 
GeneralRe: RAS...I don't get him! Pin
Masaaki Onishi27-Dec-01 7:02
Masaaki Onishi27-Dec-01 7:02 
GeneralRe: RAS...I don't get him! Pin
Joel Lucsy27-Dec-01 8:43
Joel Lucsy27-Dec-01 8:43 
GeneralRe: RAS...I don't get him! Pin
Rickard Andersson2027-Dec-01 8:57
Rickard Andersson2027-Dec-01 8:57 
GeneralIssues opening files Pin
Stew27-Dec-01 5:51
Stew27-Dec-01 5:51 
GeneralRe: Issues opening files Pin
Chris Meech27-Dec-01 9:29
Chris Meech27-Dec-01 9:29 
GeneralRe: Issues opening files Pin
Stew28-Dec-01 4:45
Stew28-Dec-01 4:45 
GeneralTurning on/off caps lock, num lock and scroll lock Pin
Nnamdi Onyeyiri27-Dec-01 5:34
Nnamdi Onyeyiri27-Dec-01 5:34 
GeneralRe: Turning on/off caps lock, num lock and scroll lock Pin
Chris Meech27-Dec-01 9:34
Chris Meech27-Dec-01 9:34 
GeneralRe: Turning on/off caps lock, num lock and scroll lock Pin
567890123430-Dec-01 1:46
567890123430-Dec-01 1:46 
QuestionModems-Connected or Not? Pin
BlackSmith27-Dec-01 1:46
BlackSmith27-Dec-01 1:46 
AnswerRe: Modems-Connected or Not? Pin
Nish Nishant27-Dec-01 1:58
sitebuilderNish Nishant27-Dec-01 1:58 
GeneralFile size in FTP server... Pin
27-Dec-01 1:22
suss27-Dec-01 1:22 

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.