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

C / C++ / MFC

 
GeneralRe: Background color of a CListBox Pin
26-Jun-02 19:00
suss26-Jun-02 19:00 
GeneralRe: Background color of a CListBox Pin
Mr. Bill27-Jun-02 5:11
Mr. Bill27-Jun-02 5:11 
GeneralSingle Instance Dialog Box Pin
Anthony988726-Jun-02 11:34
Anthony988726-Jun-02 11:34 
GeneralRe: Single Instance Dialog Box Pin
Ramu Pulipati26-Jun-02 14:15
Ramu Pulipati26-Jun-02 14:15 
GeneralRe: Single Instance Dialog Box Pin
26-Jun-02 20:20
suss26-Jun-02 20:20 
General"an unknown error occurred while accessing an unnamed file" Pin
Dean Michaud26-Jun-02 11:12
Dean Michaud26-Jun-02 11:12 
GeneralRe: "an unknown error occurred while accessing an unnamed file" Pin
Ancient Dragon26-Jun-02 14:16
Ancient Dragon26-Jun-02 14:16 
GeneralAny Idea why? .... Pin
JohnnyG26-Jun-02 10:29
JohnnyG26-Jun-02 10:29 
I've created an array of unsigned chars as a parity table. During program initialization, I originally memset the array to all zeros. In the same init sequence, I set elements of the array to one to signify that the parity bit should be set for that particular value.

// in header file
#define RADAR_PARITYTBLSZ 4096
unsigned char RadarParityTable[RADAR_PARITYTBLSZ];

// in .C file

// Initialize parity table for 12 bit radar msgs and 1 bit of parity
memset(&RadarParityTable, 0, sizeof(RadarParityTable));
for(i = 0; i < RADAR_PARITYTBLSZ; i++)
if(ComputeParity(i) == 0) // this returns 0 if value of i is even
RadarParityTable[i] = 1;

The problem is that the last element of the array, in this case [4095], (the array is 4096 bytes in size, is mysteriously set to 0x20 instead of 1. I'm using odd parity so the parity for a value of 0xfff or 4095 -- 12 binary bits set means add one to it to make it odd.

I set a breakpoint right after the code above in the init sequence and Quickwatch says ALL of the values are zero. Later when I compare parity to the parity table in another module and use quickwatch, the value for that element is 0x20. The only way I was able to fix this was to increase the size of the array by 1 to 4097, initialize the first 4096 elements the same as before, and then all of the values in the array were correct even the last one. I even tried adding this line of code below in the init sequence but it didn't work.

RadarParityTable[RADAR_PARITYTBLSZ-1] = 1;

Any ideas why it was set to hex 0x20.
GeneralRe: Any Idea why? .... Pin
jbarton26-Jun-02 11:09
jbarton26-Jun-02 11:09 
GeneralRe: Any Idea why? .... Pin
JohnnyG26-Jun-02 14:14
JohnnyG26-Jun-02 14:14 
GeneralRe: Any Idea why? .... Pin
Roger Allen26-Jun-02 13:28
Roger Allen26-Jun-02 13:28 
GeneralRe: Any Idea why? .... Pin
JohnnyG27-Jun-02 3:59
JohnnyG27-Jun-02 3:59 
GeneralRe: Any Idea why? .... Pin
Bill Wilson27-Jun-02 10:25
Bill Wilson27-Jun-02 10:25 
GeneralRe: Any Idea why? .... Pin
JohnnyG27-Jun-02 14:35
JohnnyG27-Jun-02 14:35 
GeneralRe: Any Idea why? .... Pin
Ramu Pulipati26-Jun-02 18:19
Ramu Pulipati26-Jun-02 18:19 
GeneralRe: Any Idea why? .... Pin
JohnnyG27-Jun-02 14:28
JohnnyG27-Jun-02 14:28 
GeneralRe: Any Idea why? .... Pin
Ramu Pulipati27-Jun-02 17:34
Ramu Pulipati27-Jun-02 17:34 
GeneralRe: Any Idea why? .... Pin
JohnnyG28-Jun-02 3:24
JohnnyG28-Jun-02 3:24 
GeneralRe: Any Idea why? .... Pin
JohnnyG27-Jun-02 14:40
JohnnyG27-Jun-02 14:40 
GeneralRe: Any Idea why? .... Pin
JohnnyG28-Jun-02 3:26
JohnnyG28-Jun-02 3:26 
GeneralCapturing the event Pin
26-Jun-02 9:28
suss26-Jun-02 9:28 
GeneralRe: Capturing the event Pin
Ramu Pulipati26-Jun-02 18:32
Ramu Pulipati26-Jun-02 18:32 
Generalm_hWnd Pin
Anthony988726-Jun-02 9:08
Anthony988726-Jun-02 9:08 
GeneralRe: m_hWnd Pin
Joaquín M López Muñoz26-Jun-02 9:32
Joaquín M López Muñoz26-Jun-02 9:32 
GeneralData Transfer: DLL -> VB (UDT Array with Strings) Pin
Ryan B.26-Jun-02 8:58
Ryan B.26-Jun-02 8:58 

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.