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.

Output:<br />

str1 : Here, on top of the world!<br />

word 1: Here<br />

word 2: on<br />

word 3: top<br />

word 4: of<br />

word 5: the<br />

word 6: world!<br />

strxfrm<br />

Description: Transforms a string using the locale-dependent rules. (See<br />

Remarks.)<br />

Include: <br />

Prototype: size_t strxfrm(char *s1, const char *s2, size_t n);<br />

Arguments: s1 destination string<br />

s2 source string to be transformed<br />

n number of characters to transform<br />

Return Value: Returns the length of the transformed string not including the<br />

terminating null character. If nis zero, the string is not transformed (s1<br />

{<br />

whattime time_t;<br />

struct tm nowtime;<br />

nowtime.tm_sec = 30;<br />

nowtime.tm_min = 30;<br />

nowtime.tm_hour = 2;<br />

nowtime.tm_mday = 1;<br />

nowtime.tm_mon = 1;<br />

nowtime.tm_year = 103;<br />

whattime = mktime (& nowtime);<br />

printf ("Ngày và thời gian% s \ n", ctime (& whattime));<br />

}<br />

Đầu ra:<br />

Ngày và thời gian Sat Feb1 2003 02:30:30<br />

đồng hồ (tiếp theo)<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ<br />

may be a point null in this case) and the length of s2is returned.<br />

Remarks: If the return value is greater than or equal to n, the content of s1is<br />

DS51456B trang 320<br />

difftime<br />

2004 Microchip Technology Inc<br />

indeterminate. Since MPLAB C30 doesnot support alternate locales,<br />

the transformation is equivalent to strcpy, except that the length of<br />

the destination string is bounded by n-1.<br />

strtok (Continued)<br />

Standard C Libraries with Math Functions<br />

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

4.16 DATE AND TIME FUNCTIONS<br />

The header file time.hconsists of types, macros and functions that manipulate<br />

time.<br />

clock_t<br />

Description: Stores processor time values.<br />

Include: <br />

Prototype: typedef long clock_t<br />

size_t<br />

Description: The type of the result of the sizeofoperator.<br />

Include: <br />

struct tm<br />

Description: Structure used to hold the time and date (calendar time).<br />

Include: <br />

Prototype: struct tm {<br />

Mô tả: Tìm sự khác biệt giữa hai lần.<br />

Bao gồm:<br />

Prototype: difftime đôi (time_t t1, t0 time_t);<br />

Đối số: t1 kết thúc thời gian<br />

t0 thời gian bắt đầu<br />

Quay trở lại giá trị: Trả về số giây giữa t1and t0.<br />

Ghi chú: Theo mặc định, MPLAB C30 trả về thời gian là chu kỳ hướng dẫn để<br />

difftimereturns số lượng bọ ve giữa t1and t0.<br />

Ví dụ: # include / * Cho đồng hồ, difftime * /<br />

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

dễ bay hơi int i;<br />

int main (void)<br />

{<br />

clock_t bắt đầu, dừng lại;<br />

đôi trôi qua;<br />

bắt đầu = đồng hồ ();<br />

for (i = 0; i

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

Saved successfully!

Ooh no, something went wrong!