Let me welcome you to LinuxQuestions majia!
It's nice of you that you have provided a solution for your question. Maybe you wanna mark this thread as SOLVED by using -> Thread Tools -> Mark this thread as solved.
I will just add a link for those interested in C/C++ programming.
Here it is.