November 28, 2020, 02:18:45 AM

Author Topic: [bb] SaveString - saves a string value as a file by Zethrax [ 1+ years ago ]  (Read 715 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : SaveString - saves a string value as a file
Author : Zethrax
Posted : 1+ years ago

Description : 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
<a href="codearcsac1f.html?code=3069" target="_blank">http://www.blitzbasic.com/codearcs/codearcs.php?code=3069[/url]


Code :
Code: BlitzBasic
  1. Function SaveString( filepath$, stringval$ )
  2.         ; Saves the 'stringval$' to the specified 'filepath$' as a file.
  3.         ; Returns True on success or False if there was an error.
  4.        
  5.         Local file, i, l = Len( stringval$ )
  6.         file = WriteFile( filepath$ )
  7.         If file = 0 Then Return False
  8.         For i = 1 To l
  9.                 WriteByte file, Asc( Mid( stringval$, i, 1 ) )
  10.         Next
  11.         CloseFile file
  12.         Return True
  13. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal