Lilith - K I didn't mean to sound like I was annoyed if I did cus I wasn't but firstly memblock is a Char* which I named memblock as its momentary container of information and we don't delete char*'s, no? Secondly the thing is declared as a global variable currently and it's only actual usage in the entire program is:
size = dbFileSize ( "Ludovic" ) ;
memblock = new char [size] ;
Scribe->read ( memblock, size ) ;
and...
string s = memblock ; // Convert the memblock from char* to a string so the functions below will work
So to be honest I could create it via 'char* memblock' but I always set varibles to something, even if it's just "".
dark coder - You might you know cus I'm still not following what your getting at. Here's the code:
fstream::pos_type size ; // Create size varible of special type ifstream::pos_type
char* memblock = "" ; // Create the char* which will hold all of the files content
Scribe->open( "Ludovic", ios::in | ios::binary | ios::beg ) ;
size = dbFileSize ( "Ludovic" ) ;
memblock = new char [size] ;
Scribe->read ( memblock, size ) ;
Scribe->close() ;
string s = memblock ; // Convert the memblock from char* to a string so the functions below will work
K that is, in one block, creation of the variables, data extraction from the file and converting of the char* variable 'memblock' into the S string.
Now when I run my data extraction code I get exactly what I'm looking for, i.e. what is inside of and what I put into the data file.
Quote: "Yes, 'memblock' contains the file data exactly, however! File data is not a c-style string, it does not end with a 0 byte, thus you cannot use it in any string functions such as assigning it to an std::string or calling dbText. To do either of these you MUST zero it, otherwise as I said many times above these functions have no way of knowing how long the string data you wish to send is, all you're sending is a single address remember, a pointer to a char array, this array length can be anything and the function doesn't know so it just keeps iterating at and past that passed address until it hits a 0 then it knows the length. Hopefully I won't have to explain this again ."
But what you’re saying makes no sense.
I put the contents of the data file into the memblock char* variable and then extract my data from it by putting the contents of the char* variable into a string. I get no errors and the extraction code proves you a liar by extracting the exact data from the string that I know is the same as inside of the saved file.
I convert using the code above both the data file into char* and the char* into a string.
I mean, are you saying that I need to add a zero onto data file so it knows when to end before turning it into a char* and then a string or what becuase I have no idea why that would do anything but make the char* and the string have a zero on the end of it prior to the rubbish data...
We are here and it is now.