Click or drag to resize

FWrite4 Function

X#
Write the contents of a buffer to an open file, with an ANSI to OEM conversion option.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION FWrite4(
	ptrHandle AS IntPtr,
	ptrBuffer AS BYTE[],
	dwBytes AS DWORD,
	lAnsi AS LOGIC
) AS DWORD
Request Example View Source

Parameters

ptrHandle
Type: IntPtr
The handle of the file to write to.
ptrBuffer
Type: Byte
A pointer to the buffer to write
dwBytes
Type: DWord
The number of bytes in ptrBuffer to write, beginning at the current file pointer position.
lAnsi
Type: Logic
If FALSE , an ANSI to OEM conversion is made.

Return Value

Type: DWord
The number of bytes written.
If the value returned is equal to dwBytes, the operation was successful.
If the return value is less than dwBytes or 0, this means that the length of ptrBuffer is less than dwBytes, or the disk is full, or another error has occurred. FError() can be used to determine the specific error.
Remarks
FWrite4() is the same as FWrite3() except that it provides the option of doing an ANSI to OEM conversion.
Remarks
Tip Tip
Conversions between OEM en Ansi were relevant in an Ansi environment like Visual Objects. In a Unicode environment this conversion is noto much a conversion between OEM and Ansi but a conversion between either Unicode and Ansi or Unicode and OEM.
For these conversions the runtime uses the current values of the Windows Codepage and DOS Codepage.
Examples
This example writes the contents of a PSZ to a file while performing an ANSI to OEM conversion:
X#
1LOCAL pszBuff AS PSZ
2LOCAL ptrHandle AS PTR
3pszBuff := "hello" // psz converted data
4ptrHandle := FOpen2("temp.bin", FO_READWRITE)
5IF ptrHandle != F_ERROR
6    FWrite4(ptrHandle, pszBuff,;
7    PszLen(pszBuff), FALSE)
8ENDIF
See Also