Syntax 

int PCMSGetSegment(Trip trip, int segNum, struct segmentStruct *aSegment)


Parameters 

Trip trip – Handle to a trip.


int segNum ­­– Index of the segment to be pulled from a Detailed Report. If the segNum equals -1, then segments for the next trip leg are returned, else lines for the segNum are returned.


struct segmentStruct *aSegment – The structure used to parse the segment data.

 struct segmentStruct

{

           char stateAbbrev[2];

           BOOL toll;

           char dir[2];

           char route[32];

           int miles;

           int minutes;

           char interchange[32];

};


Description

Gets a report segment, which is a single line from a Detailed Report.


Return Values 

Standard Returns


Sample Code

NewSection("PCMSGetSegment, PCMSGetNumSegments");
int nSegments = PCMSGetNumSegments(trip);
if (TestErr(nSegments > 0, "PCMSGetNumSegments"))
    {
        Log_Pcmstest("%-*s%-*s%-*s%-*s%-*s%-*s%-*s",
                    6, "State",
                    5, "Toll",
                    4, "Dir",
                    33, "Route",
                    8, "Miles",
                    8, "Min",
                    33, "Interchange");

        for (int iSegment = 0; iSegment < nSegments; ++iSegment)
        {
            segmentStruct seg;
            memset(&amp;seg, 0, sizeof(segmentStruct));

            ret = PCMSGetSegment(trip, iSegment, &amp;seg);
            if (TestErr(ret > 0, "PCMSGetSegment"))
            {
                Log_Pcmstest("%-*s%-*d%-*s%-*s%-*f%-*d%-*s",
                            6, std::string(seg.stateAbbrev, 2).c_str(),
                            5, seg.toll,
                            4, std::string(seg.dir, 1).c_str(),
                            33, seg.route,
                            8, seg.miles/10.0f,
                            8, seg.minutes,
                            3, seg.interchange);
            }           


Supported Since: PC*MILER|Connect 15

Category: Trip Reports