tailieunhanh - Programming - Software Engineering The Practice of Programming phần 6

Như chúng ta đã thấy khi so sánh các phiên bản của Markov, biến đổi này là một sự phản ánh sự trưởng thành thư viện. C + + chương trình mã nguồn ngắn hơn khoảng 20%.Exercise4-5. Nâng cao C + + thực hiện quá tải subscripting với nhà điều hành [tôi để các lĩnh vực có thể được truy cập như csv [i]. | 132 DEBUGGING CHAPTER5 rearrange data to make it easier to see what s going on. Many of these programs are part of the standard toolkit some are written to help find a particular bug or to analyze a specific program. In this section we will describe a simple program called s t r i ngs that is especially useful for looking at files that are mostly non-printing characters such as executables or the mysterious binary formats favored by some word processors. There is often valuable information hidden within like the text of a document or error messages and undocumented options or the names of files and directories or the names of functions a program might call. We also find s t r i ngs helpful for locating text in other binary files. Image files often contain ASCII strings that identify the program that created them and compressed files and archives such as zip files may contain file names strings will find these too. Unix systems provide an implementation of strings already. although it s a little different from this one. It recognizes when its input is a program and examines only the text and data segments ignoring the symbol table. Its -a option forces it to read the whole file. In effect strings extracts the ASCII text from a binary file so the text can be read or processed by other programs. If an error message no identification it may not be evident what program produced it let alone why. In that case searching through likely directories with a command like strings .exe .dll I grep mystery message might locate the producer. The strings function reads a file and prints all runs of at least MINLEN 6 printable characters. a strings extract printable strings from stream void stringsfchar name FILE fin _ i n t c i char buf BUFSIZ do once for each string for i 0 Cc getcCfin EOF if break buf i c if CT BUFSIZ break 3 if CT MINLEN print if long enough printfC s . s n name i buf while Cc EoF SECTION DEBUGGING TOOLS 133 The p r i n tf format string . s takes the string

crossorigin="anonymous">
Đã 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.