Microchip Technology SW006021-1N Benutzerhandbuch
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 328
2012 Microchip Technology Inc.
Example
#include <conio.h>
#include <string.h>
char buffer[80];
void
main (void)
{
for(;;) {
cgets(buffer);
if(strcmp(buffer, “exit” == 0)
break;
cputs(“Type ’exit’ to finish\n”;
}
}
See Also
cputs()
, puts(), putch()
CTIME
Synopsis
#include <time.h>
char * ctime (time_t * t)
Description
The
ctime()
function converts the time in seconds pointed to by its argument to a
string of the same form as described for asctime(). Thus the example program prints
the current time and date.
the current time and date.
Example
#include <stdio.h>
#include <time.h>
void
main (void)
{
time_t clock;
time(&clock);
printf(“%s”, ctime(&clock));
}
See Also
gmtime()
, localtime(), asctime(), time()
Return Value
A pointer to the string.
Note
The example will require the user to provide the time() routine as one cannot be
supplied with the compiler. See time() for more detail.
supplied with the compiler. See time() for more detail.