Segmentation Faults and Bus Errors
I was casting pointers to integers, and I'm pretty sure that I immediately go "out-of-bounds" when accessing the heap, yet I'm not sure how or why.
Maybe I'm hitting a null pointer?
Does anyone think that they could help me out?
When reading byte by byte, my compare
function seems to access one extra index, yet it shouldn't.
An example of the old error is shown on line 26 of main.cpp, it no longer errors, but instead just produces incorrect results.
Voters
your code's too long sorry xD, what's the line in question?
compare
is the function that is causing the segfault, but I'm also rapidly rewriting everything here.It's when I cast and dereference.
Around line ~30.
strcmp
is a specialized wrapper forcompare
, wherecompare
just compares sequences of bytes, I was going to fix the last bit ofstrcmp
, it's calculating thecount
incorrectly, but I still believe thatcompare
is incorrect.strcmp = string compare.
I'm renaming it to streq instead now.