TAILIEUCHUNG - Advanced Linux Programming: 2-Writing Good GNU/Linux Software

Tham khảo tài liệu 'advanced linux programming: 2-writing good gnu/linux software', công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Writing Good GNU Linux Software This chapter covers some basic techniques that most GNU Linux programmers use. By following the guidelines presented you ll be able to write programs that work well within the GNU Linux environment and meet GNU Linux users expectations of how programs should operate. Interaction With the Execution Environment When you first studied C or C you learned that the special main function is the primary entry point for a program. When the operating system executes your program it automatically provides certain facilities that help the program communicate with the operating system and the probably learned about the two parameters to main usually called argc and argv which receive inputs to your program. You learned about the stdout and stdin or the cout and cin streams in C that provide console input and output. These features are provided by the c and c languages and they interact with the GNU Linux system in certain ways. GNU Linux provides other ways for interacting with the operating environment too. 18 Chapter 2 Writing Good GNU Linux Software The Argument List You run a program from a shell prompt by typing the name of the program. Optionally you can supply additional information to the program by typing one or more words after the program name separated by spaces. These are called command-line arguments. You can also include an argument that contains a space by enclosing the argument in quotes. More generally this is referred to as the program s argument list because it need not originate from a shell command line. In Chapter 3 Processes you ll see another way of invoking a program in which a program can specify the argument list of another program directly. When a program is invoked from the shell the argument list contains the entire command line including the name of the program and any command-line arguments that may have been provided. Suppose for example that you invoke the Is command in your shell to display .

Đã 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.