Page 1 of 1

Creating a txt file

Posted: 15 Aug 2006, 01:20
by taker_kc
Does anyone know whether smartfoxserver provide a method to create txt file?

Posted: 15 Aug 2006, 15:14
by Lapo
Yes it does.
Check the server side documentation (chapter 7.1), you will find a writeFile() method

cheers

Posted: 16 Aug 2006, 03:38
by taker_kc
Alrite thanks man!

Another qn here... how can i acutally save the text into the txt file so that i can have somethiing like this when i open up the file:

"This
is a
saved file"

Posted: 18 Aug 2006, 07:21
by Lapo
Add a line feed to the end of each line. The line feed code is "\n"

Code: Select all

str = "Hello\n"
str += "World"
will produce

Hello
World

Posted: 21 Aug 2006, 05:58
by taker_kc
Alrite... Thanks man Lapo!!

Posted: 23 Aug 2006, 01:36
by taker_kc
Any idea if i wanna store my txt file in another folder??

For example my smartfoxserver was install in
C:\Program Files\SmartFoxServerPRO,

but i wanna store it in C:\Logs

Posted: 01 Dec 2010, 11:44
by mhdside
this answer is more than 4 years old :) but it might help someone looking in the forum:

you simply write the path you want to save the file to.
ex: _server.writeFile("c:/Logs/mylog.log", "hi there, this is a logged msg");