Exercises
21. | Write a short program to test the generic versions of printf and scanf. |
22. | Modify the CatFile function in Program 2-3 so that it uses WriteConsole rather than WriteFile when the standard output handle is associated with a console. |
23. | CreateFile allows you to specify file access characteristics so as to enhance performance. FILE_FLAG_SEQUENTIAL_SCAN is an example. Use this flag in Program 2-5 and determine whether there is a performance improvement for large files. Appendix C shows results on several systems. Also try FILE_FLAG_NO_BUFFERING.Program 2-4 with and without UNICODE defined. What is the effect, if any? If you have access to a Windows 9x system, determine whether or not the programs function properly on that system. |
26. | Compare the information provided by perror (in the C library) and ReportError for common errors such as opening a nonexistent file. |
27. | Test the ConsolePrompt (Program 2-1) function's suppression of keyboard echo by using it to ask the user to enter and confirm a password. |
28. | Determine what happens when performing console output with a mixture of generic C library and Windows WriteFile or WriteConsole calls. What is the explanation? |
29. | Write a program that sorts an array of Unicode strings. Determine the difference between the word and string sorts by using lstrcmp and _tcscmp. Does lstrlen produce different results from those of _tcslen? The remarks under the CompareString function entry in the Microsoft on-line help are useful. |
210. | Extend the Options function implementation so that it will report an error if the command line option string contains any characters not in the list of permitted options in the function's OptionString parameter. |
211. | Appendix C provides performance data for file copying and atou conversion using different program implementations and on different file systems. Investigate performance with the test programs on systems available to you. Also, if possible, investigate performance using networked file systems, SANs, and so on to understand the impact of various storage architectures when performing sequential file access. |
