Determining number of pages in file

This is a discussion on Determining number of pages in file within the C++ Programming forums, part of the General Programming Boards category; Folks, I'm reading in input from an external file and I want to know in advance the number of pages ...

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

    Determining number of pages in file

    Folks,

    I'm reading in input from an external file and I want to know in advance the number of pages that the external file contains....as 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 ?

    Cheers
    Starkhorn

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,821
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    I don't think that is a good approach...how 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? entropysink.com

    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, 11:39 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 05:27 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05:54 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21