Remove punctuation marks from file

Need to read in a file in C++, and remove all the punctuation and repeat words. What would be the best way to implement this? File is in the style:

word
word
words
word's
...
In pseudo-code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
open file // Use std::ifstream("/path/to/file")

if (file is open) { // Use std::ifstream::is_open()
        while (not at end-of-file) { // Use std::ifstream::good()
                read line from file // Use std::getline()
                for (i from 0 to line.size()) {
                        if (line[i] is punctuation) // Use ispunct()
                                remove character at i from line // Use std::string::remove
                }
                if (line not in buffer)
                        append line to buffer // Use std::vector::push_back()
        }
} else {
        error
}
Topic archived. No new replies allowed.