[英]How to Read/Write from text file using javascript?
I asked this question before but didn't get an answer.我之前问过这个问题,但没有得到答案。 I'm developing a Cordova game and need to implement a save/load function.
我正在开发 Cordova 游戏,需要实现保存/加载功能。 Eg A Save/Load progress, done locally.
例如,在本地完成的保存/加载进度。 Preferable similar to the fstream used in C++ reading/writing into a local text file.
优选类似于 C++ 中使用的 fstream 读取/写入本地文本文件。 I need this function to work even offline.
我需要这个功能甚至离线工作。 Any help would be appreciated.
任何帮助,将不胜感激。 Thanks!
谢谢!
You can't interact with the local filesystem in Javascript, since it's client side.您无法在 Javascript 中与本地文件系统交互,因为它是客户端。 If you want to store a value from session to session in Javascript, then you should have a look at some other kind of storage :) Have a look at https://cordova.apache.org/docs/en/3.0.0/cordova_storage_storage.md.html - It should get you on the right track :)
如果你想在 Javascript 中从一个会话到另一个会话存储一个值,那么你应该看看其他类型的存储:) 看看https://cordova.apache.org/docs/en/3.0.0/ cordova_storage_storage.md.html - 它应该让你走上正轨:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.