is there a function that can return the number of lines that a windows console is using?

a C/C++ or a windows function?