|
WriteString
int WriteString(string
filename, string string)
Return
Value
Returns OK if the string has been
successfully written. Otherwise, returns FAIL.
Parameters
filename
–the name of the
file to write to.
string
–the
string to be written.
Remarks
Writes ASCII
text from string to the file indicated by filename.
The function does not close file. Use CloseFile function to close the file. Note that
this function does not create the folder specified in the
filename. If a folder does not exist the function
will fail. Use CreateDir function to create a
folder.
Package
Plug in module:
nd_fileplg.npl
Example
The following
example demonstrates the use of WriteString.
# Example for WriteString
WriteString("C:\txt.txt","string
1")
WriteString("C:\txt.txt","string
2")
WriteString("C:\txt.txt","string
3")
WriteString("C:\txt.txt","string
4")
WriteString("C:\txt.txt","string
5")
CloseFile("C:\txt.txt")
#read
test
while
!EOF("C:\txt.txt")
Println("String
is:",
ReadString("C:\txt.txt"))
endwhile
CloseFile("C:\txt.txt")
#remove file
RemoveFile("C:\txt.txt")
Output of the example script:
String
is: string 1
String
is: string 2
String
is: string 3
String
is: string 4
String
is: string 5
|