CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: fread and newlines

  1. #1
    Join Date
    Nov 2009
    Posts
    23

    fread and newlines

    Using the 'seek ftell rewind' method reports newlines to be two bytes long and when I read the file in all the newlines are one byte long.

    So it's impossible to tell if there has been some kind of error since the reported size will always be different from the 'true' size.

    Any ideas?

    EDIT: Also, this causes me to allocate to big a buffer... Which is a mild issue.
    Last edited by jamesleighe; June 16th, 2010 at 03:19 PM.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: fread and newlines

    You won't get the discrepancy if you open the file in binary mode rather than text mode.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)