If you want to keep it simple, you could do this.
Have a file named Genisis.txt with this in it
Code:
1:1 In the..
1:2 blah
I decided to try out a little test about how you would go about allocating memory and such for each book. (You could just load one book, or segments of books at a time)
Code:
#include <iostream>
#include <fstream>
char *fileBuffer;
const long BookSize(char *book)
{
std::ifstream tempFile(book);
if(!tempFile.is_open()) {
std::cout << "Error opening " << book;
exit(1);
}
tempFile.seekg(0, std::ios::end);
long fileSize = tempFile.tellg();
tempFile.close();
return fileSize;
}
void ReadBook(char *book, long fileSize)
{
std::ifstream file(book);
if(!file.is_open()) {
std::cout << "Error opening " << book;
exit(1);
}
file.read(fileBuffer, fileSize);
file.close();
}
int main()
{
char book[50];
std::cout << "Type in the name of a Book: ";
std::cin >> book;
const long size = BookSize(book);
fileBuffer = new char [size];
ReadBook(book, size);
std::cout << std::endl;
std::cout << fileBuffer;
delete [] fileBuffer;
return 0;
}
note this is just some example code.
This is what happens
Code:
Type in the name of a book: C:\Genisis.txt
1:1 In the begining, God created the heaven and the earth.
1:2 Something about light.
Where I have a text file named Genisis.txt in C:\ that contains
1:1 In the begining, God created the heaven and the earth.
1:2 Something about light.