[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Function            strtotime - convert a string to a time structure

  Syntax              struct time *strtotime(char *source);

  Prototype in        timehk.h

  Remarks             strtotime converts a string to a time structure,
                      checking for AM/PM or 24-hour format. If seconds or
                      hundredths of seconds are not in the string, their
                      values will be set to 0 in the structure.

  Return value        returns a pointer to the storage location
                      containing the time string, or NULL if space could
                      not be allocated.

  See also            timetostr()

  Example             #include <timehk.h>

                      main()
                      {
                           struct time *now;

                           strcpy(strnow,"5:12 PM");
                           if ((now = strtotime(strnow)) != NULL)
                                printf("%d hours, %d min, %d.%d secs\n",
                                     now->ti_hour, now->ti_min,
                                     now->ti_sec, now->ti_hund);
                      }

  Program output      17 hours, 12 min, 0.0 secs


See Also: timetostr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson