Windows NT Systems Programming: Spring 1999
[ Home | Syllabus | Course Notes | Assignments | Search]
Assignment 6
Text Finder: This program will display all
occurrences of a substring within a text file. The user will type in the name of a file to
be searched and a substring to search for. Every time the user hits the "Next"
button the program will display the next line of text in the file where the substring is
found. The line number and occurrence number will also be displayed (Occurrence 1: Line
45).
Due: Feb 25.
FUNCTIONAL REQUIREMENTS:
- The text file should be read into a CEdit object in its entirety.
- The line containing the next occurrence should be visible on the screen
- The line number and occurrence number must also be displayed
- The substring found should be visually marked somehow in the display area (e.g. put an
'*' before and after the string, or replace the entire string with '*')
- After the last occurrence, hitting the "Next" button will display a message
"No more occurrences"
IMPLEMENTATION REQUIREMENTS:
- Your program must use at least one CButton, CEdit and CStatic object.
- The user should not be able to type into the areas which display the results. The only
area the user can type into is the file name box and the substring to be matched box.
HINTS: Use the CEdit object for displaying the file, Look under the class functions for
this object to find useful functions. In particular look at GetSel, ReplaceSel, Undo. To
find occurrences, put the file into a CString object and use the Find member function.
Copyright chris wild 1999.
For problems or questions regarding this web contact [Dr.
Wild].
Last updated: February 09, 1999.