I have a FOR LOOP for writing an index file. My index file depend the word that i receive in parameters and I make calculations to place my word in the index file. If my first word will be write at position 23 and the second at 14, nothing was written in my index file, only the word at position 23 was written.
// Determine the position of my word into index file
int pos = mywords[0] * 6 + 53;
if (!fs.fail())
{
for (int i = 0; i < 6; i++)
{
// Position in my index file, from beginning, is that?
fs.seekg(pos, ios::beg)
// Determine if they already had a data at this place
if (fs.peek() > 0)
{
// change my position, for not overwrite my index file
fs.seekg(pos * 4, ios::beg);
}
fs.write(mywords[i], 5)
}
fs.close();
** Note that all words had lenght of 5.