FWriteText Function | |
Write a string to an open file, with SetAnsi() dependency.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION FWriteText(
ptrHandle,
cBuffer,
nBytes
) AS DWORD CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static uint FWriteText(
Usual ptrHandle = default,
Usual cBuffer = default,
Usual nBytes = default
)
Request Example
View SourceParameters
- ptrHandle (Optional)
- Type: Usual
The handle of the file to write to. - cBuffer (Optional)
- Type: Usual
The string to write. - nBytes (Optional)
- Type: Usual
The number of bytes in cBuffer to write, beginning at the current file pointer position.
If omitted, the entire contents of cBuffer is written.
Return Value
Type:
DWord
The number of bytes written.
If the value returned is equal to
nBytes, the operation was successful.
If the return value is less than
nBytes or 0, this means that the length of
cBuffer is less than
nBytes, or the disk is full, or another error has occurred. FError() can be used to determine the specific error.
Remarks
FWriteText() is the same as FWrite() except that an ANSI to OEM conversion is made if SetAnsi() is FALSE.
Remarks Tip |
---|
This function is included for compatibility. We do not recomment using static memory for file i/o operations.
We recommend that you use the function overload that takes a byte array parameter in stead.
|
Examples
This example copies the contents of one file to another.
1DEFINE F_BLOCK := 512
2...
3cBuffer := Space(F_BLOCK)
4
5SetAnsi(FALSE)
6nInfile := FOpen2("temp.txt", FO_READ)
7nOutfile := FCreate("newfile.txt", FC_NORMAL)
8lDone := FALSE
9DO WHILE !lDone
10 nBytesRead := FReadText(nInfile, @cBuffer, F_BLOCK)
11 IF FWriteText(nOutfile, cBuffer) <
12 SLen(cBuffer)
13 ? DOSErrString(FError())
14 lDone := TRUE
15 ELSE
16 lDone := (nBytesRead = 0)
17 ENDIF
18ENDDO
19FClose(nInfile)
20FClose(nOutfile)
See Also