Partager via


CInternetFile::SetReadBufferSize

Call this member function to set the size of the temporary read buffer used by a CInternetFile-derived object.

BOOL SetReadBufferSize( 
  UINT nReadSize  
);

Parameters

  • nReadSize
    The desired buffer size in bytes.

Return Value

Nonzero if successful; otherwise 0. If the call fails, the Win32 function GetLastError may be called to determine the cause of the error.

Remarks

The underlying WinInet APIs do not perform buffering, so choose a buffer size that allows your application to read data efficiently, regardless of the amount of data to be read. If each call to Read normally involves a large aount of data (for example, four or more kilobytes), you should not need a buffer. However, if you call Read to get small chunks of data, or if you use ReadString to read individual lines at a time, then a read buffer improves application performance.

By default, a CInternetFile object does not provide any buffering for reading. If you call this member function, you must be sure that the file has been opened for read access.

You can increase the buffer size at any time, but shrinking the buffer will have no effect. If you call ReadString without first calling SetReadBufferSize, you will get a buffer of 4096 bytes.

Requirements

Header: afxinet.h

See Also

Reference

CInternetFile Class

Hierarchy Chart