Sign in to follow this  

[web] Read/Write .txt

This topic is 4517 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am about finished writing a little game in javascript. Is there anyway that I can write the scores to a txt file and read scores back with javascript? I would only need commands like these: Doc = OpenDocument(name.txt) ReadDocument(Doc, CharToRead) WriteDocument(Doc, "String") CloseDocument(Doc) If not...what other language could read and write such variables to a txt file? And what are the commands? (Without getting into server side scripting. I am renting a domain, not a server.) Thank you ~Cent

Share this post


Link to post
Share on other sites
Well you have to have a server, thats where the files are, and the server serves them up..., Anyways, the other ones I know of are server side, and they are PHP ASP and ColdFusion.

Share this post


Link to post
Share on other sites
Site-Building Tools
Supports CGI Scripts: Perl, Python, PHP3, PHP4, PHP5

Would that let me do it with PHP? Or are CGI scripts different from what I need? And if it will do so, can you point me to the commands to open/close/read/write? I can't seem to find them lieing in any tutorial.
(would rather not pay 70$/month for a server)

~Cent

Share this post


Link to post
Share on other sites
I don't know javascript very well but I imagine that it would pose a security risk if you could do that hehe.

http://www.w3schools.com/php/php_functions2.asp

Try that page if you want to use PHP to write files, but I don't know how you would incorporate it into your javascript game. Maybe have a submit score button or something that takes them to the next page, but then you'd have to make it really secure.

Share this post


Link to post
Share on other sites
Sign in to follow this