11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Library FunctionsCGETSSynopsis#include char * cgets (char * s)DescriptionThe 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, withbackspace 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) terminatingthe function. The collected string is null terminated.Example#include #include char buffer[80];voidmain (void){for(;;) {cgets(buffer);if(strcmp(buffer, "exit") == 0)break;cputs("Type ’exit’ to finish\n");}}See Alsogetch(), getche(), putch(), cputs()133

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!