Quote:
Originally Posted by Mike Betts
Matt,
There is a lot of your declarations not shown (such as your pid structure) but I'm guessing your issue is with the printf statement. "measurement" is declared as a long at the top of your function and being passed to printf as a long but printf is expecting an int. It should be cast as "(int) measurement". This would throw off all of your stack variables by two bytes each.
Output may be non-zero but I doubt it is correct.
Good Luck...
Mike
|
ha....it sickens me that this was actually the problem. This was the THIRD time I have been screwed by those printf's in C(used to java, C++). Thank You. That fixed the problem, but I'm curious as to how this works. Why does it throw off the stack variables by two bytes each?(Not that I know much about the "stack" anyways

) and how did you know this? Could you point me to a paper or something that explains how some of these "inner workings" work?
EDIT: I knew it expected ints and I forgot that I changed measurement to a long, but I still wouldn't have expected that one mistake to mess up the rest of the function.