0

I'm trying to write a program for my brother that does some quick and dirty re-formatting from an outline in a text document to a .csv for his flashcard program to read. the outline looks like this:

1) Question
   a) answer 1
   b) answer 2
   **c) answer 3**
   d) answer 4

with the correct answer in bold. And the format the .csv needs to be in looks like this:

question 1, correct answer, incorrect answer 1, incorrect answer 2, incorrect answer 3, incorrect answer 4 (etc)
question 2, correct answer, incorrect answer 1, incorrect answer 2, incorrect answer 3, incorrect answer 4 (etc)

etc..

I haven't written any code yet because I'm still planning it out, but I have a pretty good idea of how I'll do it. I'm just not familiar enough with c++ file io to know of any way to check for bold. Any advice or links to information on how I can do this in a word document would be much appreciated, thanks.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Jonathan
  • 167
  • 10
  • 2
    Bold is presentation, are you trying to look for bolded text in a text document? Is this text document a word document? – wkl Apr 25 '12 at 17:30
  • Yes this is a word document, .doc to be specific. Are there c++ libraries for interacting with word or anything like that? – Jonathan Apr 25 '12 at 17:49
  • You'll want to use a library like mentioned in here: http://stackoverflow.com/questions/3296610/how-to-read-ms-word-documents-using-mfc or here: http://stackoverflow.com/questions/301132/microsoft-word-text-parser-in-c – wkl Apr 25 '12 at 17:57

1 Answers1

4

There's no one, uniform way of looking for "bold," because how its represented in the text depends on the application that creates it. If you're just checking straight text, and you have no idea of the specific format of that text, then there is no way of knowing what "bold" is. If, for example, it were HTML, you could look for pairs of "bold" tags. Otherwise, a plain text file has no standard way of indicating bold because it's just, as the name implies, plain text.

David W
  • 10,062
  • 34
  • 60