CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2006
    Posts
    26

    Resolved File handling in mfc's(previous record)

    Hi,
    How to access the previous record from a file in MFC's.
    For example we are reading data from a file and after reading some records if we want to read the previous record, then how can we to this.
    and how can we directly read the last record from the file.
    If we use SeekToEnd() we are going to the end of the file and not able to read the last record.
    Even I am not able to read the file record by record.For that I am reading the file upto a new line character occurs and then using Seek to move the pointer.
    Here I am assuming each line as a new record.
    Please help me.Give some examples.
    Thank you.
    Last edited by rajeswaridevi; October 5th, 2006 at 12:20 AM.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: File handling in mfc's(previous record)

    What do you mean by "record"?

  3. #3
    Join Date
    Apr 2003
    Location
    kathmandu, nepal
    Posts
    1,570

    Re: File handling in mfc's(previous record)

    You cannot do this if you have a variable record size (i.e. number of bytes in the record). Otherwise if you have a fixed record size (i.e. each record containing a predefined number of bytes), then you can supply the bytes offset to find a particular record and read.
    If there is no love sun won't shine

  4. #4
    Join Date
    Jun 2005
    Posts
    64

    Re: File handling in mfc's(previous record)

    Are you handling Flat file ?
    Quote Originally Posted by rajeswaridevi
    Even I am not able to read the file record by record.For that I am reading the file upto a new line character occurs
    I think you are assuming a line read from file as a record :-?
    what are trying to do ?

    Thanks
    Rajesh.

  5. #5
    Join Date
    Jul 2006
    Posts
    26

    Re: File handling in mfc's(previous record)

    HI,
    Here I am assuming each line as a new record. And each line is of vaiable length.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured