Creating a txt file

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
taker_kc
Posts: 6
Joined: 07 Jun 2006, 13:58

Creating a txt file

Post by taker_kc »

Does anyone know whether smartfoxserver provide a method to create txt file?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Yes it does.
Check the server side documentation (chapter 7.1), you will find a writeFile() method

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
taker_kc
Posts: 6
Joined: 07 Jun 2006, 13:58

Post 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"
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
taker_kc
Posts: 6
Joined: 07 Jun 2006, 13:58

Post by taker_kc »

Alrite... Thanks man Lapo!!
taker_kc
Posts: 6
Joined: 07 Jun 2006, 13:58

Post 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
mhdside
Posts: 236
Joined: 04 May 2008, 07:57
Location: Egypt

Post 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");
Mahmoud Badri
Senior actionscript developer
http://www.el3ab.com
Post Reply