Hello everyone.
I´m trying to read from the local folder an txt file.
If i put on it a breakline, Corona simply trims there the string.
If i dont break the line and try put \n Corona reads it as normal text.
I record the txt as utf-8.
how to read or put a break line on the txt file?
Is correct the system.ResourceDirectory, and the txt file will be packed in the apk?
Thanks.
This is the code:
[lua]local function leficheiro(txt)
local contents = “”
local path = system.pathForFile( txt, system.ResourceDirectory )
local file = io.open( path, “r” )
if (file) then
– read all contents of file into a string
contents = file:read()
file:close()
– io.close( file )
print(contents)
else
print(“file not found”)
end
print(path)
return contents
end[/lua]