Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
Library Functions
 2012 Microchip Technology Inc.
DS52053B-page 325
CEIL 
Synopsis
#include <math.h>
 
double ceil (double f)
Description
This routine returns the smallest whole number not less than 
f
.
Example
#include <stdio.h>
#include <math.h>
void
main (void)
{
    double j;
    scanf(“%lf” &j);
    printf(“The ceiling of %lf is %lf\n”, j, ceil(j));
}
CGETS 
Synopsis
#include <conio.h>
 
char * cgets (char * s)
Description
The 
cgets()
 function will read one line of input from the console into the buffer passed 
as an argument. It does so by repeated calls to getche(). As characters are read, 
they are buffered, with backspace deleting the previously typed character, and ctrl-U 
deleting the entire line typed so far. Other characters are placed in the buffer, with a 
carriage return or line feed (newline) terminating the function. The collected string is 
null terminated.
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”);
    }
}