object Level_0 type=Level
TileBinaryData:{insert lots of random bits here
Width=50
Height=50
LevelName="TestLevel"
end
I added a couple hooks to my Reader/Writer classes that wrap around fread/fwrite which just takes a pointer and a size essentially. Writing worked fine as I said, but about ~400 bytes into reading the tiles some internal buffer in the FILE structure would run out, and fread would start to fail from then on. That led me to believe there's a fixed limit on how big text files will successfully read but that's not the case as my binary data actually reduces the file size quite a bit as I'm able to be more efficient with the storage.
At any rate, adding a little 'b' to the fopen calls when appropriate seems to have solved the issues just fine. Not a big deal once I figured it out but it was a bit frustrating to come across it in this manner. Looks like this isn't terribly uncommon either as a quick google search yielded a few hits...
http://stackoverflow.com/questions/474733/unexpected-output-copying-file-in-c
File IO seems like exactly the kind of API that is unforgiving, somewhat finicky to get working right, and once you're done you never touch it again. I look forward to never having to touch it again some day. As an upside level saving/loading is now significantly faster, and there's even further room to optimize as I add binary import/export options to the property system (currently only doing manual binary writes for the tiles).