I'm redoing bible a program I wrote which parses a raw text file and produces a file of my own format.
I use some C++, but my question concerns memmove (I think at least), so I'm posting in the C section.
Here's the format of my file:
(2 byte) length of title in bytes
(1 byte) length of copyright in bytes
(2 bytes) number of books
(4 bytes) byte locations of each book
(2 bytes) length of book name in bytes
(2 bytes) number of chapters in book
(4 bytes) byte locations of each chapter
(2 bytes) number of verses in chapter
(4 bytes) byte locations of each verse
(2 bytes) length of each verse in bytes
Obviously, the book and chapter information repeats for every book and chapter, respectively.
What's happening, as you can see from this picture, is the locations of the chapters are not writing correctly after it reaches a certain point (I commented out writing the verse locations and book locations). In the text highlighted in black, the value is being written as B4 98 0D 0A, when it SHOULD be written as B4 98 0A. I'll attach the source too.
The four-byte groups are actual (correct) chapter locations for the book of Genesis.
I'm almost 100% sure the bug is in the function ParseToBuffer
EDIT: actually, I commented it's the book locations I didn't comment out. The verse location and chapter writing is what is commented out.