Some one seriously needs to kill this thread. The original poster has been given multiple working examples, or at least the theory to get it working, and they continually ignore the examples. Furthermore, they blatently ignore lessons on how to write safe code. Yet time and time again, they keep returning wondering why it doesn't work.
They obviously don't care to learn, or they would have learned something by now. There are multiple examples to learn from, they just intentionally disregard said examples.