Read A Text File in Corona

Posted by Unknown Minggu, 27 Oktober 2013 0 komentar
Reading a text file in corona is very eazy.First get the file path and using the file path read the content in the file. Check the code below.
  display.setStatusBar( display.HiddenStatusBar )
-- read the file path
local filePath = system.pathForFile( "myFile.txt", system.ResourceDirectory )

local file = io.open( filePath, "r" )
if file then
-- read all contents of file into a string
local contents = file:read( "*a" )

print( "The file path is" .. filePath )
print( contents )

io.close( file )

end


Copy and download the code and try your self.
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Read A Text File in Corona
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke http://androidpopuler.blogspot.com/2013/10/read-text-file-in-corona.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.