Functions.FPutS Method (IntPtr, String)
Write a string, a carriage-return character, and a linefeed character to an open file.
XSharp.Core (in XSharp.Core.dll) Version: 2.16
Syntax Request Example
ptrHandle AS IntPtr,
cBuffer AS STRING
) AS DWORD
public static uint FPutS(
- Type: IntPtr
The handle of the file to write to.
- Type: String
The string to write.
The number of bytes written.
If the value returned is equal to nBytes
+ 2, the operation was successful.
If the return value is less than nBytes
+ 2 or 0, this means that the length of cBuffer
was less than nBytes
, or the disk is full, or another error has occurred.
FPuts() is a low-level file function that writes data to an open file from a string buffer. You can either write all or a portion of the buffer contents. Writing begins at the current file position, and the function returns the actual number of bytes written.
This function is assumed to handle raw binary data and is not dependent upon the status of SetAnsi(). FWriteText() and FWrite4(), on the other hand, are dependent upon SetAnsi().
This example uses FPuts() to write lines starting at the beginning of a file.
The carriage-return/linefeed pair increase the return value by 2:
1ptrHandle := FOpen2("c:\data\sales", FO_READWRITE)
2? FPuts(ptrHandle, "Line1")
3? FPuts(ptrHandle, "Line1", 2)