www.icetips.com  Icetips Utilities Documentation 10/29/2008    

String Class:  WriteStringToFile

Previous  Top  Next  


Prototype: (String pFileName, String pContent),Long,PROC

 

pFileNameName of file to write the string to
pContentContent to write to the file

 

ReturnsReturns the number of bytes written to the file

 

This method writes the passed string to the specified file.  The content can be anything, but would normally be written to a text file, although there is nothing preventing this from being used with binary data files.  Note that there is no option to append to an existing file, only write to a new file.  This method uses the AllocateFileString to allocate memory for the contents and by doing so re-allocates the FileString.  Because of that you need to make sure that you do not have important data in the FileString property before you call this method.

 

Example:

ITS  ITStringClass

S    String(1024)

Code

S = 'Icetips Creative, Inc.<13,10>' &|

    '136 E. 8th Street #351<13,10>' &|

    'Port Angeles, WA 98362<13,10>'

ITS.WriteStringToFile('C:\Temp\Test.txt')

 

This will write the contents of the string to a file called C:\Temp\Test.txt and it will now contain this:

 

Icetips Creative, Inc.

136 E. 8th Street #351

Port Angeles, WA 98362

 

See also:

FileString

ReadFileToString

WriteQToFile

AllocateFileString

DisposeFileString



Direct link to this page: http://www.icetips.com/manuals/utilities/writestringtofile_stringclass.htm