Correctly getting IFstream?
I have a problem figuring how to get this
It can varry
For example
Ge1:1 == Thats smallest Probably
1Cor12:31== Probably the biggest
I need to seperate the book "Ge = Genesis" "1Cor == 1 Corinthians" from the chapter # or ## (right after book) and the verse :# or :##
It would be nice if some1 could help me or tell a dos program that can insert spaces correctly or another KJV bible that is already seperated0
Please and Thank You
[485 byte] By [
7Priest7] at [2007-11-20 8:26:47]

# 1 Re: Correctly getting IFstream?
im going to attempt to try an answer even though im new to c++ i think the problem your describing is because the fstream class's ">>" operation doesnt copy any whitespace into your destination (spaces or newlines)
so if your using a string object as a container try this code:
// assuming your file object is names fin
getline(fin, <destination>);
otherwise this:
fin.getline(<destination>, <size>);
# 2 Re: Correctly getting IFstream?
im going to attempt to try an answer even though im new to c++ i think the problem your describing is because the fstream class's ">>" operation doesnt copy any whitespace into your destination (spaces or newlines)
so if your using a string object as a container try this code:
// assuming your file object is names fin
getline(fin, <destination>);
otherwise this:
fin.getline(<destination>, <size>);
I dont want a get line
Rev22:21 The grace of our Lord Jesus Christ be with you all. Amen.
I need to get that in 4 parts
Part 1: Rev
Part 2: 22
Part 3: 21
Part 4: The grace of our Lord Jesus Christ be with you all. Amen.
# 3 Re: Correctly getting IFstream?
I dont want a get line
I need to get that in 4 parts
Part 1: Rev
Part 2: 22
Part 3: 21
Part 4: The grace of our Lord Jesus Christ be with you all. Amen.You need to first set the general rules as to how all lines are constructed. Otherwise, how will you know which part is Part1, Part2, etc.? You don't know where Part 1 ends and Part 2 begins, etc.
For example, do all lines start with a set of alphabetic characters (denoting Part 1), then followed by a number (denoting Part 2), then followed by a colon separating Part 2 from Part 3, etc.? If there are any lines that do not follow the general pattern, then there is no way to get all the lines correctly parsed.
But in general, if there is a general pattern, all you need to do is read a line in a string, and parse the line yourself using std::string or similar functions.
Regards,
Paul McKenzie
# 4 Re: Correctly getting IFstream?
Well, Being a bible reader, you already know how to seperate them like you want. All verses are in the same universal pattern:
<book> <num>:<num> <quote>
Now let me show you a little trick.
string the;
string t = "t";
string h = "h";
string e = "e";
t + h + e = the;
cout << the << endl;
The above would output the and it would contain "the". Use that trick and you can easily seperate them. Why? Because you know that the book goes until the first num and the second num is after the : and the first letter after : is the start of the verse.