TAILIEUCHUNG - the ansi c programming phần 7

Unix nguyên đã được phát triển để tạo ra một hệ thống tự động lập hồ sơ cho các bằng phát minh. Phiên bản đầu tiên của Unix đã phát triển từ ngôn ngữ Assembly. Sau đó, ngôn ngữ C đã được phát triển để từ đó thay thế hệ điều hành mới. | 127 arguments of if they are the wrong type. You should also be aware of the difference between these two calls printf s FAILS if s contains printf s s SAFE The function sprintf does the same conversions as printf does but stores the output in a string int sprintf char string char format arg1 arg2 . sprintf formats the arguments in arg1 arg2 etc. according to format as before but places the result in string instead of the standard output string must be big enough to receive the result. Exercise 7-2. Write a program that will print arbitrary input in a sensible way. As a minimum it should print non-graphic characters in octal or hexadecimal according to local custom and break long text lines. Variable-length Argument Lists This section contains an implementation of a minimal version of printf to show how to write a function that processes a variable-length argument list in a portable way. Since we are mainly interested in the argument processing minprintf will process the format string and arguments but will call the real printf to do the format conversions. The proper declaration for printf is int printf char fmt . where the declaration . means that the number and types of these arguments may vary. The declaration . can only appear at the end of an argument list. Our minprintf is declared as void minprintf char fmt . since we will not return the character count that printf does. The tricky bit is how minprintf walks along the argument list when the list doesn t even have a name. The standard header contains a set of macro definitions that define how to step through an argument list. The implementation of this header will vary from machine to machine but the interface it presents is uniform. The type va_list is used to declare a variable that will refer to each argument in turn in minprintf this variable is called ap for argument pointer. The macro va_start initializes ap to point to the first unnamed argument. It must be called once before ap is used.

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.