Dragonfly Q&A

loadSprite corrupting label with ifstream

0 like 0 dislike
When testing my loadSprite, I came across an issue that I cannot figure out the cause of. The case I am using is testing loadSprite on the saucer-spr.txt from the tutorial, with a label of "saucer." The issue is that, for some reason, when I initialize an ifstream to begin parsing the file, it corrupts the label, reducing it from "saucer" to "er". I'm  not sur why this is happening, as I don't even use the label until after the file is closed. If anyone has had a similar experience or has advice on how to solve this issue, please help! Thank you.
asked Sep 28, 2014 by cgporell
I ended up fixing this. The issue was a pointer I created that was messing up the memory after its initialization, but never reported errors like segfaults.
Glad you found the problem!  Spurious string values (or other data types) that get changed are often a result of pointer problems. If a pointer accesses memory and changes a value, it may or may not cause a segmentation fault - it depends upon whether or not the memory is legitimately allocated to the process.

Please log in or register to answer this question.

More information about Dragonfly can be found on the Dragonfly Home Page.
...