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.

Return Value: Returns the offset in bytes of the specified member (mbr) from<br />

the<br />

beginning of the structure.<br />

Remarks: The macro offsetofis undefined for bitfields. An error message will<br />

occur if bitfields are used.<br />

Example: #include /* for offsetof */<br />

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

struct info {<br />

char item1[5];<br />

int item2;<br />

char item3;<br />

float item4;<br />

};<br />

int main(void)<br />

{<br />

printf("Offset of item1 = %d\n",<br />

offsetof(struct info,item1));<br />

printf("Offset of item2 = %d\n",<br />

offsetof(struct info,item2));<br />

printf("Offset of item3 = %d\n",<br />

offsetof(struct info,item3));<br />

printf("Offset of item4 = %d\n",<br />

offsetof(struct info,item4));<br />

}<br />

Output:<br />

Offset of item1 = 0<br />

Offset of item2 = 6<br />

Offset of item3 = 8<br />

Offset of item4 = 10<br />

Explanation:<br />

This program shows the offset in bytes of each structure member from<br />

the start of the structure. Although item1is only 5 bytes (char<br />

item1[5]), padding is added so the address of item2falls on an<br />

even boundary. The same occurs with item3; it is 1 byte (char<br />

item3) with 1 byte of padding.<br />

Standard C Libraries with Math Functions<br />

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

4.13 INPUT AND OUTPUT<br />

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

support<br />

_IONBF<br />

Mô tả: Cho biết không có đệm.<br />

Bao gồm:<br />

Ghi chú: Được sử dụng bởi các chức năng setvbuf.<br />

BUFSIZ<br />

Mô tả: Xác định kích thước của bộ đệm được sử dụng bởi các chức năng setbuf<br />

Bao gồm:<br />

Giá trị: 512<br />

Thư viện chuẩn C với hàm toán học<br />

2004 Microchip Technology Inc DS51456B trang 227<br />

EOF<br />

Mô tả: Một số âm cho thấy các tập tin end-of-đã đạt tới hoặc<br />

báo cáo một điều kiện lỗi.<br />

Bao gồm:<br />

Ghi chú: Nếu một tập tin end-of-là gặp phải, chỉ số cuối cùng của tập tin được<br />

thiết lập. Nếu một<br />

tình trạng lỗi gặp phải, chỉ số lỗi được thiết lập. Lỗi<br />

điều kiện bao gồm ghi errorsand đầu vào hoặc đọc lỗi.<br />

FILENAME_MAX<br />

Mô tả: Tối đa số ký tự trong một tên tập tin bao gồm cả null<br />

terminator.<br />

Bao gồm:<br />

Giá trị: 260<br />

FOPEN_MAX<br />

Mô tả: Xác định số lượng tối đa của tập tin có thể được mở cùng một lúc<br />

Bao gồm:<br />

Giá trị: 8<br />

Bình luận: stderr, stdinand stdoutare bao gồm trong FOPEN_MAXcount.<br />

L_tmpnam<br />

Mô tả: Xác định số lượng ký tự cho tên tập tin tạm thời dài nhất<br />

tạo ra bởi các chức năng tmpnam.<br />

Bao gồm:<br />

Giá trị: 16<br />

Bình luận: L_tmpnamis sử dụng để xác định kích thước của mảng được sử dụng<br />

bởi tmpnam.<br />

NULL<br />

Mô tả: Giá trị của một con trỏ hằng rỗng<br />

Bao gồm:<br />

SEEK_CUR<br />

Mô tả: Chỉ ra rằng fseekshould tìm kiếm từ vị trí hiện tại của tập tin

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

Saved successfully!

Ooh no, something went wrong!