Click to Rate and Give Feedback
MSDN
MSDN Library
Networking
Network Protocols
Windows Internet
WinINet Reference
WinINet Functions
 InternetWriteFile Function
InternetWriteFile Function

Writes data to an open Internet file.

Syntax

C++
BOOL InternetWriteFile(
  __in   HINTERNET hFile,
  __in   LPCVOID lpBuffer,
  __in   DWORD dwNumberOfBytesToWrite,
  __out  LPDWORD lpdwNumberOfBytesWritten
);

Parameters

hFile [in]

Handle returned from a previous call to FtpOpenFile or an HINTERNET handle sent by HttpSendRequestEx.

lpBuffer [in]

Pointer to a buffer that contains the data to be written to the file.

dwNumberOfBytesToWrite [in]

Number of bytes to be written to the file.

lpdwNumberOfBytesWritten [out]

Pointer to a variable that receives the number of bytes written to the file. InternetWriteFile sets this value to zero before doing any work or error checking.

Return Value

Returns TRUE if the function succeeds, or FALSE otherwise. To get extended error information, call GetLastError. An application can also use InternetGetLastResponseInfo when necessary.

Remarks

When the application is sending data, it must call InternetCloseHandle to end the data transfer.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
VersionInternet Explorer 3.0 or later
HeaderWininet.h
LibraryWininet.lib
DLLWininet.dll

See Also

Common Functions
WinINet Functions

Send comments about this topic to Microsoft

Build date: 11/19/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Remarks      Gynvael Coldwind   |   Edit   |   Show History
When using the InternetWriteFile function with a handle set by HttpSendRequestEx, be sure to finalize the data upload with the HttpEndRequest funtion.
Tags What's this?: Add a tag
Flag as ContentBug
documentation correction      Mark Beiley   |   Edit   |   Show History
I believe:

lpdwNumberOfBytesWritten
[out] Pointer to a variable that receives the number of bytes written to the buffer.
should instead be:

lpdwNumberOfBytesWritten
[out] Pointer to a variable that receives the number of bytes written to the file.
Thanks,
Mark
--
http://www.beiley.com

Tags What's this?: Add a tag
Flag as ContentBug
InternetWriteFile causes AV in Vista RTM with IE7      Omer Atay   |   Edit   |   Show History

If you are using InternetWriteFile to write to a file that is opened by FtpCommand with APPE command, InternetWriteFile may cause an access violation. See http://support.microsoft.com/default.aspx/kb/934376 for more details. This is fixed in Vista SP1.

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker