fread & msdn

This is a discussion on fread & msdn within the Windows Programming forums, part of the Platform Specific Boards category; from msdn Code: size_t fread( void *buffer, size_t size, size_t count, FILE *stream ); is this wrong? shouldnt it be ...

  1. #1
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299

    fread & msdn

    from msdn
    Code:
    size_t fread( 
       void *buffer,
       size_t size,
       size_t count,
       FILE *stream 
    );
    is this wrong?
    shouldnt it be
    size_t count, then
    size_t size,
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    You can use either way, as size*count will always be the same as count*size, but just remember that fread will always returns the number of full ITEMS read, not bytes. If I use fread however, I normally just use 1 as the size so I can see exactly how many bytes were read.

  3. #3
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    but just remember that fread will always returns the number of full ITEMS read, not bytes.
    i needed to read the fine print
    thx
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fread problems or memory problems
    By Lechuza in forum C Programming
    Replies: 1
    Last Post: 03-22-2009, 12:45 PM
  2. Why is fread sometimes taking so long?
    By manugarciac in forum C++ Programming
    Replies: 2
    Last Post: 04-28-2007, 11:25 PM
  3. msdn
    By wheelie in forum C++ Programming
    Replies: 3
    Last Post: 04-14-2007, 05:53 PM
  4. fread item_size limit
    By nvoigt in forum C++ Programming
    Replies: 2
    Last Post: 03-30-2005, 08:08 AM
  5. MSDN Searching Tips
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-19-2004, 04:51 AM

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