Xbasic
FILE.FROM_STRING Function
Syntax
Byte_Count as N = FILE.From_string(C Filename,C string[,C Encoding])
Arguments
- FilenameCharacter
The path and name of the file to create.
- stringCharacter
The character data to write into the file.
- EncodingCharacter
Specifies alternate encoding, supplying 'utf8' with add the standard UTF8 beggining of file marker to the text file.
Returns
- Byte_CountNumeric
Returns the size of the file.
Description
Writes a string to a file.
Discussion
The FILE.FROM_STRING() method creates a file from character data.
Example
dim cc as C cc = FILE.to_string("C:\Frame.Txt") ? len(cc) = 1777.000000 FILE.from_string("c:\new_frame.txt", cc) ' Write a UTF encoded string with a UTF header ustring = convert_acp_to_utf8("Musée d'anthropologie") file.from_string("c:\data\museum.txt",ustring,"utf8")
The target directory must exist or the function will fail.
See Also