Let me see first. Thanks for your quick reply Subsonics,
I will let you all know, if I get proper solution.
I really don't understand why you are trying to change the size of the terminal inside the terminal. Normally you would change the terminal before you run your program. Also what "terminal" are you actually trying to use? There are several "terminal" programs available in Linux, for example xterm, Gnome terminal, etc. See this link for more examples. Most of these terminal emulators have ways to set their size when called, check the documentation for the actual emulator you are using.
I may be confused, the changes would set your window size. I think you actually intended to get the size. Nevermind, I changed the constant to TIOCSWINSZ, which would then set the size to *rows, *cols.
Then why can't you change the size of the terminal before you run your program? If the terminal is being launched by another app, what app? You should be able to force the terminal to a certain size by using the geometry modifier:
That solved my problem.