Parsing Text from File
I have a text file I am trying to read from. It is delimited by several different characters. Below is a sample of one of the text files I am trying to read:
@001 State the name of the principal (person giving power):
~Enter the name of the person who is giving the power of
@440 Enter the place of residence of the principal:
~Enter the city, state of residence of the person giving the
@441 State the name of the attorney:
~Enter the name of the person to act on your behalf; although
~they are referred to as “Attorney” they do not need to be an
@442 Enter the place of residence of the attorney:
~Enter the city, state of the attorney; for example, Buffalo,
#1801 Will the attorney have BANKING authority?
~Select yes if the attorney will be able to handle banking
@443 Name the bank (do not use word bank if it is last):
~Enter the name of the bank; the word bank is supplied in the
~text of the document; for example if the bank is the 4th
~National Bank, simple enter 4th National
@444 Enter the city and state where the bank is located:
~Enter the city, state where the bank is located; for example
~Raleigh, North Carolina
#1802 Will the attorney execute a deed or real estate conveyance?
~Select yes if the attorney will sign a deed or other real estate
@445 State the description of the property:
~Enter the legal description of the property; that is the lot and
~block number or a metes and bounds description, NOT the address
#1803 Will the attorney obtain/review educational records?
~Select yes if the attorney will be able to review or obtain
@300 Enter the name of the school or college:
~State the name of the school or college where the attorney will
~be able to review or obtain your records
@301 Enter the city and state where the school is located:
~State the city, state where the school is, for example, Bismark,
#1806 Will the attorney have other authority?
~If other powers are to be granted, select yes
@448 State the authority NARROWLY and PRECISELY:
@449 Enter the beginning date of the power of attorney:
~State the date when the power of attorney becomes effective
@450 Enter the ending date of the power of attorney:
~State the ending date of the power
@003 Enter the state where signed:
~Enter the name of the state where this document is signed
@004 Enter the county where signed:
~Enter the county, parish, judicial district or borough where
~this power is signed
#end control section
I want to be able to assign the values without a tilde next to them to a label and the values with a tilde to a text box.
If this is too much to ask for in a forum I will remove the post. I have been racking my brain for a couple weeks on this and feel I have probably overlooked more simpler solutions.
Any and all help will be greatly appreciated.
The very first and last # sings can be ignored, they just set up the control file. I would like to fill a form with several labels and textedits, or if it would easier, depending on what character the iterator comes across, call a dialog. I don’t really have any code to show as I was originally attempting this in C#. Woke up one morning and decided it was time to learn C++.
I may be asking too much, but if I could get help with finding a good starting point I could make it roll.
In that case i would advise you to read a good starting book like this one :
bq. C++ GUI Programming with Qt 4, by Jasmin Blanchette; Mark Summerfield
If you google you can find a free pdf of it.
Chapter 12. Input/Output explains how you can read your file.
chapter 1,2 gives you a good intro in the use of labels, forms and so on.
If you have specific questions feel free to ask here.
Have fun programming!