Write TXT file


#1

I’m trying write a txt file into a GX dev for some configuration data for our application

But i can’t see the file in the script explore

What is the correct path to save the txt file ?

I use a LUA commands to write, read and save files (write, read & flush), but the file never is saved into the unit or is saved in other path.

I create a file with script explore, but i can’t acces it (always DS send a msg “incorrect path”)

For your comments

Thanks

Jerry


#2

Hi Jerry,

Could you share the Lua code snippet you are using? In particular, in which location are you trying to save the file?

Thanks,
Benjamin.


#3

Hi Benjamin

local name = “./prueba.txt”

local f = io.open(name, “a+”)

f:seek(“end”)
f:write(“tenemos,algunas,novedades 1”…"\n")
f:write(“tenemos,algunas,novedades 2”…"\n")
f:write(“tenemos,algunas,novedades 3”…"\n")
f:flush()
f:close()

If read after this point i can get the 3 lines, but, when close the function and check the file again the file is empty

Thnkas


#4

Hi,

The more convenient way to store data would be to store data using the persist module instead of a file. This module enable to persist Lua tables. Documentation is available at http://developer.sierrawireless.com/Resources/Resources/Tools/ALEOS_AF_Home.aspx .

For debugging and installation, only .lua sources files from your project’s sources folders are copied on the GX.
So, you should not expect to see your local project sources to be updated when something is changed on the target. Actually you should use the “Remote Systems” view available in the “Remote System Explorer” perspective, or a good old SSH shell, to browse the GX400 filesystem…
While debugging, you will be able to read your filein “Remote System Explorer” under the filter tmp/projectname/ . If you use a ssh console, you will find those files at their real location /tmp/RA/projectname. Those files will be erased before another debug session on the same project.

Regards


#5

Hi Jerry,
As Kevin pointed out, files are erased between run/debug sessions - do you think this may be the problem?
A way to check this would be to install the application into the device so that it is in the non-volatile portion of flash. To do this right click on your application folder, choose Export, choose “Sierra Wireless” > “Local Application Project”, give it a version and select your host (192.168.13.31) and click Finish.
To remove the application go to the Remote System View, click on “Application Container” and then right click on your application and choose to uninstall it.

-Kevin


#6

Thanks!!

If the TXT file is created into the device (using “Remote System”, “Scp Files”, “appcon”) the file can be accesed for the aplication (read, write, re-write, etc…), and the file can keep the data.

Jerry


#7

Happy to hear things are looking up.

So is that to say the complete problem is resolved or is there still a problem with creating new files with the io module (and what you described is just a work around)?

Thanks!
-Kevin


#8

Resolve completely, only is required create the file directly into the GX400 applications folder

Thanks

Jerry