home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

16.7 Exercises

See Appendix A, Exercise Answers for the answers.

  1. Write a program that takes a machine name as input and then prints a list of all of the IP addresses for that machine (skip this example if you don't have TCP/IP installed). Try your program on something like www.microsoft.com that has lots of IP addresses to make sure you get it right.

  2. Write a program that takes as an argument a single Registry key relative to HKEY_LOCAL_MACHINE and prints all of the values under it (don't worry about recursing into child keys or about binary data for now, just print whatever you get).

  3. Write a subroutine that creates all of the keys in a path if they don't exist. To make things easier, pass in the subtree to which the path is relative.

  4. Using what you know about unpack , write a routine that will print a hexidecimal representation of a REG_DWORD value (that is, a four-byte integer value).