I believe your file I/O is incorrect. If you compile in debug mode, your debugger should be able to give you more specific information (ie. specific line or a call stack). I don't really have experience outside of Visual Studio's debugger though.
outputFile.read(tocWordBuffer, tocPosition + 0x04);That code means that you read a total of tocPosition + 4 bytes. Which will certainly buffer overflow your 4 byte array. Since you are no longer reading the entire file into a byte array and processing the byte array, you can simplify the code to not use pointers, awkward casts, or a buffer variable.
tocWord = *reinterpret_cast<uint32_t*>(tocWordBuffer);
outputFile.read(&tocWord, 4); // Can also use sizeof(tocWord) or sizeof(uint32_t) instead of 4
Oh wow, you're totally right. Not sure why I wrote it that way there, because I did it the correct way everywhere else. I apparently also told it to write tocPosition bytes for filesize instead of 4. It's writing garbage if I change the filesize, but at least now it's only 4 bytes of it.
I just tried doing &tocWord like you wrote, but it causes a compile-time error:
argument of type "uint32_t *" is incompatible with parameter of type "const char *"
EDIT: Nevermind, I got it. I just needed to add a reinterpret cast to it. Also, I wanted to write filesize, not the current word. I guess I was tired when I wrote that part. I think the program works now.
Onward to messing with TableLib and Atlas to try and make them work with TLoD for dumping/insertion. I feel like the dumper will actually be harder, but maybe I'm wrong. Atlas I should be able to do as you said before and make a new pointer type. I'm also thinking I'll need to dump text and text box dimensions sequentially, so in the dumper I'll need to merge their two pointer tables together, meaning I'll have to add something to Atlas to alternately write pointers to two separate tables.