T
terry
I am a programmer (cobol, peoplesoft, sqr, etc.) so I am familiar
with programming logic, etc. but not very familiar with C. I need a C
program in a study I'm doing. The program is fairly simple, but not
familiar with C code it would take me some time to get it to work. A
good C programmer can probably give me the code in a few minutes.
Here's the program specs:
I'm doing a study on the italicized words in the King James Bible. The
italicized words are words not in the Greek and Hebrew text but were
added by the translators for sentence structure, etc.
I have a text file of the Old Testament and the New Testament. The
italicized words are surrounded by brackets []. If a verse contains
any italicized words I want to write that verse to a new flat-file
that I will use in Word to look at, get counts, and do some grammar
statistics, etc.
Here's a sample of the input flat-file with a few verses from Genesis.
Notice verses 2, 4, and 7 contain italicized words or brackets.
1 In the beginning God created the heaven and the earth.
2 And the earth was without form, and void; and darkness [was] upon
the face of the deep. And the Spirit of God moved upon the face of the
waters.
3 And God said, Let there be light: and there was light.
4 And God saw the light, that [it was] good: and God divided the light
from the darkness.
5 And God called the light Day, and the darkness he called Night. And
the evening and the morning were the first day.
6 And God said, Let there be a firmament in the midst of the waters,
and let it divide the waters from the waters.
7 And God made the firmament, and divided the waters which [were]
under the firmament from the waters which [were] above the firmament:
and it was so.
8 And God called the firmament Heaven. And the evening and the morning
were the second day.
So my output file would look like
2 And the earth was without form, and void; and darkness [was] upon
the face of the deep. And the Spirit of God moved upon the face of the
waters.
4 And God saw the light, that [it was] good: and God divided the light
from the darkness.
7 And God made the firmament, and divided the waters which [were]
under the firmament from the waters which [were] above the firmament:
and it was so.
The logic I came up with would be something like:
Read a character from the flat-file:
Check for a number
If number (indicates a new verse)
If a "[" is found (found_flag) from previous verse
write the WORK AREA stored verse to the output file.
Possibly need to write an eol character
Clear out the work area
Clear out the found [ flag
If a [ is NOT found (found-flag) then
clear the stored verse
Move each character to a WORK AREA
Check each character for a "["
If found set the found_flag = y
Got get another character
Another variation I would like to do is create an output file of JUST
the italicized words or bracketed words.
A couple of questions or issues:
How large a file can C read?
The Old Testament file is 3,282,275 characters (size is 3,342,336
bytes) If needed I could cut up the files.
Is there a better way?
I will probably use Borland C+ as the compiler.
If possible, please email any solutions to (e-mail address removed)
Thank you very much for your time and expertise.
with programming logic, etc. but not very familiar with C. I need a C
program in a study I'm doing. The program is fairly simple, but not
familiar with C code it would take me some time to get it to work. A
good C programmer can probably give me the code in a few minutes.
Here's the program specs:
I'm doing a study on the italicized words in the King James Bible. The
italicized words are words not in the Greek and Hebrew text but were
added by the translators for sentence structure, etc.
I have a text file of the Old Testament and the New Testament. The
italicized words are surrounded by brackets []. If a verse contains
any italicized words I want to write that verse to a new flat-file
that I will use in Word to look at, get counts, and do some grammar
statistics, etc.
Here's a sample of the input flat-file with a few verses from Genesis.
Notice verses 2, 4, and 7 contain italicized words or brackets.
1 In the beginning God created the heaven and the earth.
2 And the earth was without form, and void; and darkness [was] upon
the face of the deep. And the Spirit of God moved upon the face of the
waters.
3 And God said, Let there be light: and there was light.
4 And God saw the light, that [it was] good: and God divided the light
from the darkness.
5 And God called the light Day, and the darkness he called Night. And
the evening and the morning were the first day.
6 And God said, Let there be a firmament in the midst of the waters,
and let it divide the waters from the waters.
7 And God made the firmament, and divided the waters which [were]
under the firmament from the waters which [were] above the firmament:
and it was so.
8 And God called the firmament Heaven. And the evening and the morning
were the second day.
So my output file would look like
2 And the earth was without form, and void; and darkness [was] upon
the face of the deep. And the Spirit of God moved upon the face of the
waters.
4 And God saw the light, that [it was] good: and God divided the light
from the darkness.
7 And God made the firmament, and divided the waters which [were]
under the firmament from the waters which [were] above the firmament:
and it was so.
The logic I came up with would be something like:
Read a character from the flat-file:
Check for a number
If number (indicates a new verse)
If a "[" is found (found_flag) from previous verse
write the WORK AREA stored verse to the output file.
Possibly need to write an eol character
Clear out the work area
Clear out the found [ flag
If a [ is NOT found (found-flag) then
clear the stored verse
Move each character to a WORK AREA
Check each character for a "["
If found set the found_flag = y
Got get another character
Another variation I would like to do is create an output file of JUST
the italicized words or bracketed words.
A couple of questions or issues:
How large a file can C read?
The Old Testament file is 3,282,275 characters (size is 3,342,336
bytes) If needed I could cut up the files.
Is there a better way?
I will probably use Borland C+ as the compiler.
If possible, please email any solutions to (e-mail address removed)
Thank you very much for your time and expertise.