Try HostFOpen and HostFPrintF, for logging during POSER runs.

I use a little wrapper to open/close the file and then invoke some test cases.
This function refers to a couple of simple alert forms, a yes/no and 
a FrmCustomAlert
target.

void HostprintTest() {
   DWord temp;
#define outname "my output file"
   HostFILE *outf;
   DateTimeType DateTimeScratch;
   ULong startsecs, endsecs;
   Char *charScratch;
 
   if (!HostGremlinIsRunning())
     MemSetDebugMode(FrmAlert(MemDebugModeAlert) ? 
(memDebugModeScrambleOnChange|memDebugModeAllHeaps) : 0);

   if (FtrGet ('pose', 0, &temp) == ftrErrNoSuchFeature) {
     _Debug2("HostprintTest", "can't run test suite on real Palm device");
     return;
   }

   charScratch = MemPtrNew(longDateStrLength);
   outf = HostFOpen(outname, "a");
   HostFPrintF(outf, "\n\n>>>>>>>POSERmain start ");
   startsecs = TimGetSeconds();
   TimSecondsToDateTime(startsecs, &DateTimeScratch);
   DateToAscii((Byte) DateTimeScratch.month, (Byte) 
DateTimeScratch.day, (Byte) DateTimeScratch.year,
               dfDMYLong, charScratch);
   HostFPrintF(outf, "%s ", charScratch);
   TimeToAscii((Byte) DateTimeScratch.hour, (Byte) DateTimeScratch.minute,
               tfColon24h, charScratch);
   HostFPrintF(outf, "%s:%d\n", charScratch, (int) DateTimeScratch.second);

   //  insert test code here
   CalendarChecks2000 (outf);
   MeeusTimeChecks(outf);
   //  end of test code

   HostFPrintF(outf, "\n<<<<<<<POSERmain finish  ");
   endsecs = TimGetSeconds();
   TimSecondsToDateTime(endsecs, &DateTimeScratch);
   DateToAscii((Byte) DateTimeScratch.month, (Byte) 
DateTimeScratch.day, (Byte) DateTimeScratch.year,
               dfDMYLong, charScratch);
   HostFPrintF(outf, "%s ", charScratch);
   TimeToAscii((Byte) DateTimeScratch.hour, (Byte) DateTimeScratch.minute,
               tfColon24h, charScratch);
   HostFPrintF(outf, "%s:%d, elapsed time %d\n", charScratch, (int) 
DateTimeScratch.second,
               (int) (endsecs - startsecs));

   HostFClose(outf);
   MemPtrFree(charScratch);
}
----
Hal Mueller                [EMAIL PROTECTED]
Mobile Geographics LLC
Seattle, Washington        (206) 297-9575
 

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to