how to use append function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pralu
    New Member
    • Mar 2008
    • 34

    how to use append function

    Code:
    		EventLogEntryStruct EventLogEntry[100];
    		for(int i=1;;i++)
    		{
    			EventLogEntry[i].logName = "log-";
    			EventLogEntry[i].eventString = "event-";
    
    
    			EventLogEntry[i].bufPos = i;
    			EventLogEntry[i].logIdx = i+1;
    			logName.append(i);//= "log-";
    			EventLogEntry[i].dateTime = i+4;
    			EventLogEntry[i].systemTick = i;
    			EventLogEntry[i].resetCount = 1;
    			EventLogEntry[i].inAir = 1;
    			EventLogEntry[i].appSpec1 = i+2;
    			EventLogEntry[i].appSpec2 = i+3;
    			EventLogEntry[i].appSpec3 = i+1;
    			EventLogEntry[i].timeStampLSW = 12;
    			EventLogEntry[i].timeStampMSW = 24;
    			EventLogEntry[i].timeStamp = 22;
    			EventLogEntry[i].timeDelta = 12;
    			EventLogEntry[i].windowID = i+2;
    			eventString.append(i);// = "event-1";


    here EventLogEntrySt ruct is a structure defined in my header file and i have created an instance of it as EventLogEntry. now i have to run an infinite loop as its a code in the server side which will be continuously sending data to the client ... now i want to change the logName and eventString everytime in the loop so what i did is at line no 4& 5 i ve declared it and used the append function at line no. 10 & 23 but its throwing error of:

    [HTML]D:\trial\server Trial.cpp(175) : error C2065: 'logName' : undeclared identifier
    D:\trial\server Trial.cpp(175) : error C2228: left of '.append' must have class/struct/union type
    D:\trial\server Trial.cpp(188) : error C2065: 'eventString' : undeclared identifier
    D:\trial\server Trial.cpp(188) : error C2228: left of '.append' must have class/struct/union type[/HTML]
    so can any one plz help me ut in sorting this error..
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Originally posted by pralu
    Code:
    			logName.append(i);//= "log-";
    Shouldn't this be

    Code:
    EventLogEntry[i].logName.append(i);//= "log-";

    Comment

    • pralu
      New Member
      • Mar 2008
      • 34

      #3
      Originally posted by Banfa
      Shouldn't this be

      Code:
      EventLogEntry[i].logName.append(i);//= "log-";

      no it should not be... but i got it how to dooo

      thnx ..

      Comment

      Working...