Thread: how many lines

  1. #1
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385

    how many lines

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

    a C/C++ or a windows function?
    Monday - what a way to spend a seventh of your life

  2. #2
    Registered User minime6696's Avatar
    Join Date
    Aug 2001
    Posts
    267

    Post Please...

    No offence, but you need to learn a bit, I would be happy to teach you. C/c++ is a LANGUAGE, its not an API. Theres no "C++ Functions". And also you're not being clear about what your saying. If I get it correctly, you should be recording how many lines your printing, tho I see no practical use for this.

    SPH

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    you could write a algorithm that
    gets the hieght of the screen (in inches),
    get the point size of the font,
    multiply the point size by 72,
    devide the height by the answere to bove instruction,
    devide that number by 72.

    That is probaly not the fastest or anything but should work.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    ummm acturally there are C++ functions. All of them are listed in the ANSI standard(or whatever the eqivilent for C++ is ANSI is for C but since C++ is a extention of C the ANSI standard functions are still present).

  5. #5
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Something like GetConsoleScreenBufferInfo() ?

  6. #6
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    C++ functions are those defined in the ANSI C ++ standard, the windows programming board is for windows specific - not just winapi. As the console is for windows and i need to use a function probably defined in the windows.h header - i posted it to the specific board.

    >>see no practical use - thats because i didnt say why i wanted to use it.

    why do i multiply it be 72?

    --thanks to isometric and sorenson.
    Last edited by iain; 01-18-2002 at 01:18 PM.
    Monday - what a way to spend a seventh of your life

  7. #7
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    The reason for multiplying by 72 is that originally a point(for a font) was 1 72ndth of a inch. Although while recently reaserching I found a better way of doing it. GetSystemMetrics funtion, its discribed in more detail on page 82 -93 (including example code) of the bibe, The Windows programming one that is ((Programming Windows 5th edition by Charles petzold). or you should be able to look it up on MSDN tho I havent tried that.

  8. #8
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    thanks very much ismoetric - the project i am working on with this will benefit all the regular members of the board!
    Monday - what a way to spend a seventh of your life

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 10-07-2008, 06:19 PM
  2. Print out first N lines
    By YoYayYo in forum C Programming
    Replies: 1
    Last Post: 02-21-2008, 12:58 AM
  3. Finding number of lines of code
    By arron in forum Linux Programming
    Replies: 8
    Last Post: 01-06-2006, 05:35 AM
  4. Reading lines from a file
    By blackswan in forum C Programming
    Replies: 9
    Last Post: 04-26-2005, 04:29 PM
  5. count only lines of code...
    By flightsimdude in forum C Programming
    Replies: 13
    Last Post: 09-23-2003, 07:08 PM