Click here to Skip to main content
15,893,161 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWM_CONTEXTMENU Pin
pranavamhari16-Jul-03 7:34
pranavamhari16-Jul-03 7:34 
QuestionMFC - How to print ? Pin
Exim16-Jul-03 6:55
Exim16-Jul-03 6:55 
GeneralHeapValidate question Pin
Anonymous16-Jul-03 6:27
Anonymous16-Jul-03 6:27 
GeneralRe: HeapValidate question Pin
Mike Dimmick16-Jul-03 6:48
Mike Dimmick16-Jul-03 6:48 
GeneralRe: HeapValidate question Pin
Anonymous16-Jul-03 7:09
Anonymous16-Jul-03 7:09 
GeneralRe: HeapValidate question Pin
Peter Weyzen16-Jul-03 7:52
Peter Weyzen16-Jul-03 7:52 
GeneralRe: HeapValidate question Pin
Mike Dimmick16-Jul-03 22:28
Mike Dimmick16-Jul-03 22:28 
QuestionGetting the same value everytime?? Pin
johnstonsk16-Jul-03 6:01
johnstonsk16-Jul-03 6:01 
I am trying to spin through an array in a struct and for each element in that array I want to get the value of another array in another struct.
The problem I am having is that the value is always the same.

My structs are:
<br />
 struct TSimHeader<br />
    {<br />
	    char   Name[45][20];<br />
	    char   Unit[45][20];<br />
	    double Min[45];<br />
	    double Max[45];<br />
	    int SignalCount;<br />
	    int SimStatus;<br />
<br />
    }static TSimHeader_arr[10];<br />
<br />
<br />
    struct TSimSignal<br />
    {<br />
       	double Value[45];<br />
	    double TimeStamp;<br />
<br />
    }static TSimSignal_arr[10];


My function to match elements in the TSimHeader_arr[0].Name[] array with the same element in the TSimSignal_arr[0].Value[] is:

void Tflight_data::getValues(){<br />
   int numSignals = RFMAccess::TSimHeader_arr[0].SignalCount;<br />
<br />
    for(int i=0; i<numSignals; i++){<br />
        char* temp  = RFMAccess::TSimHeader_arr[0].Name[i];<br />
        char* temp2 = RFMAccess::TSimHeader_arr[0].Name[i+1];<br />
<br />
        if(strcmp(temp, "pla"))<br />
            display_pla_level(RFMAccess::TSimSignal_arr[0].Value[i]);<br />
<br />
        if(strcmp(temp, "pitch_stickF")&& strcmp(temp2, "roll_stickF")){<br />
            roll = (RFMAccess::TSimSignal_arr[0].Value[i] / 10.0);<br />
            pitch = (RFMAccess::TSimSignal_arr[0].Value[i+1] / 10.0);<br />
            flight_data->fwd_pl->Repaint();<br />
        }<br />
        if(strcmp(temp, "nose_wow")){<br />
            if(RFMAccess::TSimSignal_arr[0].Value[i] != 0)<br />
                front_wheel_led->Active = true;<br />
        }<br />
        if(strcmp(temp, "left_wow")){<br />
            if(RFMAccess::TSimSignal_arr[0].Value[i] != 0)<br />
                left_wheel_led->Active = true;<br />
        }<br />
        if(strcmp(temp, "right_wow")){<br />
            if(RFMAccess::TSimSignal_arr[0].Value[i] != 0)<br />
                right_wheel_led->Active = true;<br />
        }   <br />
        if(strcmp(temp, "pitch_trim"))<br />
            pitch_data_lb->Caption = (AnsiString)RFMAccess::TSimSignal_arr[0].Value[i];<br />
<br />
        if(strcmp(temp, "roll_trim"))<br />
            roll_data_lb->Caption = (AnsiString)RFMAccess::TSimSignal_arr[0].Value[i];<br />
<br />
        if(strcmp(temp, "yaw_trim"))<br />
            yaw_data_lb->Caption = (AnsiString)RFMAccess::TSimSignal_arr[0].Value[i];<br />
   <br />
     }<br />
}


The values should be different depending on the word in the char array. It should match with the exact element in the Values array.

Any ideas why I am getting the same value on each if statement?

I hope I explained it well enough.

Thanks,
stevenSmile | :)
AnswerRe: Getting the same value everytime?? Pin
David Crow16-Jul-03 7:02
David Crow16-Jul-03 7:02 
AnswerRe: Getting the same value everytime?? Pin
Peter Weyzen16-Jul-03 7:58
Peter Weyzen16-Jul-03 7:58 
AnswerRe: Getting the same value everytime?? Pin
Ryan Binns16-Jul-03 17:33
Ryan Binns16-Jul-03 17:33 
GeneralEDID data, display driver Pin
oliver.hu16-Jul-03 5:19
oliver.hu16-Jul-03 5:19 
GeneralTemplates and functions Pin
Bernhard16-Jul-03 4:59
Bernhard16-Jul-03 4:59 
GeneralRe: Templates and functions Pin
Ryan Binns16-Jul-03 5:06
Ryan Binns16-Jul-03 5:06 
GeneralRe: Templates and functions Pin
Andrew Walker17-Jul-03 3:03
Andrew Walker17-Jul-03 3:03 
GeneralRe: Templates and functions Pin
Bernhard17-Jul-03 3:29
Bernhard17-Jul-03 3:29 
Generalmy solution (pretty neat i think) Pin
Bernhard17-Jul-03 4:14
Bernhard17-Jul-03 4:14 
Generalpolling for data on serial port Pin
butterbean73016-Jul-03 4:50
butterbean73016-Jul-03 4:50 
GeneralRe: polling for data on serial port Pin
John R. Shaw16-Jul-03 6:21
John R. Shaw16-Jul-03 6:21 
GeneralDisplay cad drawings Pin
BigBabyJesus16-Jul-03 4:09
BigBabyJesus16-Jul-03 4:09 
GeneralRe: Display cad drawings Pin
Ryan Binns16-Jul-03 4:21
Ryan Binns16-Jul-03 4:21 
GeneralRussian string to/from file Pin
Bartosz Bien16-Jul-03 3:41
Bartosz Bien16-Jul-03 3:41 
GeneralRe: Russian string to/from file Pin
Ryan Binns16-Jul-03 4:11
Ryan Binns16-Jul-03 4:11 
GeneralGet Number of Logical Processors Pin
Nathan Blomquist16-Jul-03 3:41
Nathan Blomquist16-Jul-03 3:41 
GeneralRe: Get Number of Logical Processors Pin
valikac16-Jul-03 4:46
valikac16-Jul-03 4:46 

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.