简体   繁体   中英

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. Eg A Save/Load progress, done locally. Preferable similar to the fstream used in C++ reading/writing into a local text file. 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. 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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM