This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Read/write file to LM5 connected USB
#2
Here you have a script for mounting USB:
Code:
part = '/dev/sda1'

if io.exists(part) then
 os.execute('mount ' .. part .. ' /mnt')
 alert('mount ok')
else
 alert('usb disk not found')
end

And this is for writing and reading a file from USB:
Code:
path = '/mnt/'
status = io.exists(path)

io.writefile(path .. 'new.txt', 'This is my new file.')

result = io.readfile(path .. 'new.txt')
log(status, result)
Reply


Messages In This Thread
RE: Read/write file to LM5 connected USB - by buuuudzik - 16.03.2017, 19:13

Forum Jump: