Code archives/File Utilities/SaveString - saves a string value as a file

This code has been declared by its author to be Public Domain code.

Download source code

SaveString - saves a string value as a file by Zethrax2013
Saves the specified string value as a file.

Can be used in combination with the 'GetInternetFile' function linked below to download and save a file.

GetInternetFile - downloads a file as a string
http://www.blitzbasic.com/codearcs/codearcs.php?code=3069
Function SaveString( filepath$, stringval$ )
	; Saves the 'stringval$' to the specified 'filepath$' as a file.
	; Returns True on success or False if there was an error.
	
	Local file, i, l = Len( stringval$ )
	file = WriteFile( filepath$ )
	If file = 0 Then Return False
	For i = 1 To l
		WriteByte file, Asc( Mid( stringval$, i, 1 ) )
	Next
	CloseFile file
	Return True
End Function

Comments

None.

Code Archives Forum