21.07.2015 Views

Programming Info D2XXPG31.pdf

Programming Info D2XXPG31.pdf

Programming Info D2XXPG31.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

79 D2XX Programmer's Guide5.4 FT_W32_WriteFileWrite data to the device.BOOL FT_W32_WriteFile(FT_HANDLE ftHandle, LPVOID lpBuffer, DWORD dwBytesToWrite,LPDWORD lpdwBytesWritten, LPOVERLAPPED lpOverlapped)ParametersftHandlelpBufferdwBytesToWritelpdwBytesWrittenlpOverlappedHandle of the device.Pointer to the buffer that contains the data to write to thedevice.Number of bytes to be written to the device.Pointer to a variable that receives the number of bytes writtento the device.Pointer to an overlapped structure.Return ValueIf the function is successful, the return value is nonzero.If the function is unsuccessful, the return value is zero.RemarksThis function supports both non-overlapped and overlapped I/O, except under Windows CEwhere only non-overlapped IO is supported.Linux does not support the W32 API.Non-overlapped I/OThe parameter, lpOverlapped, must be NULL for non-overlapped I/O.This function always returns the number of bytes written in lpdwBytesWritten.This function does not return until dwBytesToWrite have been written to the device.When a write timeout has been setup in a previous call to FT_W32_SetCommTimeouts 94 , thisfunction returns when the timer expires or dwBytesToWrite have been written, whichever occursfirst. If a timeout occurred, lpdwBytesWritten contains the number of bytes actually written, and thefunction returns a non-zero value.An application should always use the function return value and lpdwBytesWritten. If the returnvalue is non-zero and lpdwBytesWritten is equal to dwBytesToWrite then the function hascompleted normally. If the return value is non-zero and lpdwBytesWritten is less thendwBytesToWrite then a timeout has occurred, and the write request has been partially completed.Note that if a timeout occurred and no data was written, the return value is still non-zero.Overlapped I/OWhen the device has been opened for overlapped I/O, an application can issue a request andperform some additional work while the request is pending. This contrasts with the case of non-© Future Technology Devices International Ltd. 2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!