Click here to Skip to main content
15,912,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to dynamically update an xml file in C++ Pin
kakan11-Dec-05 20:56
professionalkakan11-Dec-05 20:56 
GeneralRe: How to dynamically update an xml file in C++ Pin
Christian Graus11-Dec-05 19:22
protectorChristian Graus11-Dec-05 19:22 
GeneralRe: How to dynamically update an xml file in C++ Pin
Alex Orovetskiy12-Dec-05 0:41
Alex Orovetskiy12-Dec-05 0:41 
GeneralRe: How to dynamically update an xml file in C++ Pin
Christian Graus12-Dec-05 11:00
protectorChristian Graus12-Dec-05 11:00 
AnswerRe: How to dynamically update an xml file in C++ Pin
ThatsAlok11-Dec-05 23:56
ThatsAlok11-Dec-05 23:56 
QuestionReturning struct from functions syntax in VC++ Pin
Vaclav11-Dec-05 18:21
Vaclav11-Dec-05 18:21 
AnswerRe: Returning struct from functions syntax in VC++ Pin
Christian Graus11-Dec-05 18:42
protectorChristian Graus11-Dec-05 18:42 
AnswerRe: Returning struct from functions syntax in VC++ Pin
basementman12-Dec-05 6:57
basementman12-Dec-05 6:57 
Structs are typically passed by pointer. In the case of struct arrays, it really depends on how you allocate the array. By incrementing a struct pointer, you actually increment the pointer to point to the next struct (the compiler increments it by the sizeof() the struct).

EX:

typedef struct _MyStruct
{
  int iValue;
  char caData[21];
} MyStruct;

MyStruct *StructFcn(MyStruct *spStruct, int iCount);

void PassStructToFcn()
{
  MyStruct *spRetval = NULL;
  MyStruct sStruct;

  sStruct.iValue = 7;
  strcpy(sStruct.caData,"Hello");

  spRetval = StructFcn(&sStruct,1);
}

void PassStructArrayToFcn()
{
  MyStruct *spRetval = NULL;
  MyStruct sStruct[3];  // array of 3 structs

  sStruct[0].iValue = 2;
  strcpy(sStruct[0].caData,"Hello");
  sStruct[1].iValue = 3;
  strcpy(sStruct[1].caData,"Hello");
  sStruct[2].iValue = 7;
  strcpy(sStruct[2].caData,"Hello");

  spRetval = StructFcn(&sStruct[0],3);
}



MyStruct *StructFcn(MyStruct *spStruct, int iCount)
{
  // find the struct who's value is 7
  for (int iLup = 0; iLup < iCount)
    {
      if (spStruct->iValue == 7)
        return spStruct;

      spStruct++;
    }

  return NULL;
}


 onwards and upwards... 

-- modified at 12:58 Monday 12th December, 2005
Questioni wnt to develop firewall Pin
wilusili11-Dec-05 17:59
wilusili11-Dec-05 17:59 
AnswerRe: i wnt to develop firewall Pin
Christian Graus11-Dec-05 18:07
protectorChristian Graus11-Dec-05 18:07 
Generalgo... Pin
wilusili11-Dec-05 18:39
wilusili11-Dec-05 18:39 
GeneralRe: go... Pin
Christian Graus11-Dec-05 18:41
protectorChristian Graus11-Dec-05 18:41 
GeneralRe: go... Pin
lafifa11-Dec-05 21:15
lafifa11-Dec-05 21:15 
GeneralRe: go... Pin
ThatsAlok12-Dec-05 22:58
ThatsAlok12-Dec-05 22:58 
GeneralRe: go... Pin
Eytukan12-Dec-05 0:52
Eytukan12-Dec-05 0:52 
GeneralRe: go... Pin
Eytukan12-Dec-05 0:48
Eytukan12-Dec-05 0:48 
GeneralRe: go... Pin
ThatsAlok12-Dec-05 22:35
ThatsAlok12-Dec-05 22:35 
AnswerRe: i wnt to develop firewall Pin
MarcelErz12-Dec-05 23:11
MarcelErz12-Dec-05 23:11 
Questionhow to make a server application??? Pin
cancerion11-Dec-05 17:54
cancerion11-Dec-05 17:54 
AnswerRe: how to make a server application??? Pin
sunit511-Dec-05 23:14
sunit511-Dec-05 23:14 
Questionantialiasing Pin
Nishad S11-Dec-05 17:33
Nishad S11-Dec-05 17:33 
AnswerRe: antialiasing Pin
Christian Graus11-Dec-05 18:58
protectorChristian Graus11-Dec-05 18:58 
GeneralRe: antialiasing Pin
Nishad S11-Dec-05 19:01
Nishad S11-Dec-05 19:01 
GeneralRe: antialiasing Pin
Christian Graus11-Dec-05 19:03
protectorChristian Graus11-Dec-05 19:03 
GeneralRe: antialiasing Pin
Nishad S11-Dec-05 19:10
Nishad S11-Dec-05 19:10 

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.