Thread: Determining number of pages in file

  1. #1
    Registered User starkhorn's Avatar
    Join Date
    Sep 2003

    Determining number of pages in file


    I'm reading in input from an external file and I want to know in advance the number of pages that the external file I want to break-up the input page by page.

    Is there a method to determine the number of pages in say a .txt file or a .pdf file ?


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Not without reading the whole file.

    A PDF file might contain the information, but that is a proprietary file format.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User axon's Avatar
    Join Date
    Feb 2003
    I don't think that is a good would you measure the size of a page on a txt file?

    But whatever you do, just like Salem said you must read in the whole file first; than maybe count pages as 80 chars per row multiplied by whatever number of rows.

    some entropy with that sink?

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM