30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

#include /* include I/O facilities */<br />

The standard headers can be included in any order. Do not include a standard<br />

header<br />

within a declaration. Do not define macros that have the same names as<br />

keywords<br />

before including a standard header.<br />

A standard header never includes another standard header.<br />

4.2.2 Library Files<br />

The archived library files contain all the individual object files for each library<br />

function.<br />

When linking an application, the library file must be provided as an input to the<br />

linker<br />

(using the --libraryor -llinker option) such that the functions used by the<br />

application may be linked into the application.<br />

A typical C application will require three library files: libc-omf.a, libm-omf.a,<br />

and<br />

libpic30-omf.a. (See Section 1.2 “OMF-Specific Libraries/StarTup Modules”<br />

for more on OMF-specific libraries.) These libraries will be included<br />

automatically if<br />

linking is performed using the MPLAB C30 compiler.<br />

Note: Some standard library functions require a heap. These include the<br />

standard<br />

I/O functions that open files and the memory allocation functions. See the<br />

MPLAB ASM30, MPLAB LINK30 and Utilities User’s Guideand MPLAB<br />

C30 C Compiler User’s Guidefor more information on the heap.<br />

Standard C Libraries with Math Functions<br />

2004 Microchip Technology Inc. DS51456B-page 195<br />

4.3 DIAGNOSTICS<br />

The header file assert.hconsists of a single macro that is useful for debugging<br />

logic<br />

errors in programs. By using the assert statement in critical locations where<br />

certain<br />

conditions should be true, the logic of the program may be tested.<br />

Assertion testing may be turned off without removing the code by defining<br />

NDEBUG<br />

before including . If the macro NDEBUGis defined, assert()is ignored<br />

and no code is generated.<br />

assert<br />

Description: If the expression is false, an assertion message is printed to stderr<br />

and<br />

the program is aborted.<br />

Include: <br />

Prototype: void assert(int expression);<br />

Argument: expression The expression to test.<br />

khác<br />

printf ("# isnot chữ cái \ n");<br />

}<br />

Đầu ra:<br />

B là chữ cái<br />

# Là không chữ cái<br />

iscntrl<br />

Mô tả: Kiểm tra cho một nhân vật điều khiển.<br />

Bao gồm:<br />

Nguyên mẫu: int iscntrl (int c);<br />

Đối số: nhân vật c để kiểm tra.<br />

Quay trở lại giá trị: Trả về một giá trị khác không số nguyên nếu nhân vật là<br />

một nhân vật kiểm soát;<br />

nếu không, trả về số không.<br />

Bình luận: Một nhân vật được coi là một nhân vật kiểm soát nếu giá trị ASCII<br />

của nó là<br />

trong phạm vi 0x00 đến 0x1f bao gồm, hoặc 0x7F.<br />

Ví dụ: # include / * Cho iscntrl * /<br />

# include / * Cho printf * /<br />

int main (void)<br />

{<br />

char ch;<br />

ch = 'B';<br />

if (iscntrl (ch))<br />

printf ("B là một điều khiển nhân vật \ n");<br />

khác<br />

printf ("B là Nota kiểm soát ký tự \ n");<br />

ch = '\ t';<br />

if (iscntrl (ch))<br />

printf ("Một tab isa ký tự điều khiển \ n");<br />

khác<br />

printf ("Một thẻ là không một nhân vật điều khiển \ n");<br />

}<br />

Đầu ra:<br />

B là không một nhân vật điều khiển<br />

Một thẻ là một nhân vật kiểm soát<br />

isalpha (Tiếp theo)<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ

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

Saved successfully!

Ooh no, something went wrong!