Thread: To access multiple pages of a file

  1. #1
    Registered User
    Join Date
    Jun 2007
    Location
    Qatar
    Posts
    39

    Smile To access multiple pages of a file

    Hi all,
    I want to access/read different pages of a text file.(I mean how i can jump on different pages in a file).Can any help me in this respect.
    thanxxxxxxxxxxx

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    You should define first what is the page... The standard text file has no such thing
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Perhaps you're thinking of some kind of document file?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  4. #4
    Registered User
    Join Date
    Jun 2007
    Location
    Qatar
    Posts
    39
    You can say,it may be a Pdf file or document file.But i am facing problem in accessing Pdf file in C++.And now i have to access a file with multiple pages.

  5. #5
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    For standard file access in C++, you would be using the fstream classes. The fstream classes can understand formatting for raw text (i.e. .txt) and for binary information (i.e. 0101011).
    PDF, WordDoc, Rich Text and all of those other things are stored in specified formats (that's why different programs can all use them). C++ does not come with libraries to handle these formats, but you can probably find SDKs online. What format are you dealing with in this "multi-paged" document?
    Last edited by CodeMonkey; 07-03-2007 at 12:57 AM. Reason: typo
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  6. #6
    Registered User
    Join Date
    Jun 2007
    Location
    Qatar
    Posts
    39
    Dear,
    i am using at the moment a txt file for my program.But i have to extend my program upto multiple pages.One idea i have in my mind is to put page number between the lines in txt file and then to read those numbers.Any other idea will be appreciated.
    Thanxxxxxxxxxxxxx

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    A text file has no concept of pages. You have to explain how you want to identify different page. What makes a page in your text file? Is it 80 lines? Is it 200 lines? Is it however much text fits in a page when you open it with Wordpad?

    The problem with separating pages with a page number is that you might not know whether the number is part of the text or not. Most file types that keep track of page numbers do it with special codes that are placed in the text.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. Saving with CFile (how)
    By jinx in forum Windows Programming
    Replies: 1
    Last Post: 10-18-2001, 09:19 AM