You will find a general example for the use of gResult here.

The script prohibits the deletion of odd-numbered templates.

int main ()
{
    if (gRecordID % 2)
    {
        sprintf (gResult,
         		"Ungeradzahlige Templates (%d) können nicht gelöscht werden.",
         		gRecordID);
    }
    return 0;
}

Alphabetic index HTML hierarchy of classes or Java