lua - How do I save directory information from os.execute("dir") into a string? -
is possible save directory info obtained os.execute("dir") string form?
so in directory <dell> have files info.txt , readme.txt. want use os.execute("dir") , have files info.txt , readme.txt saved string dir. guess entire string read dell; info.txt, readme.txt.
no, using io.popen should work.
io.popen (prog [, mode])this function system dependent , not available on platforms.
starts program
progin separated process , returns file handle can use read data program (ifmode"r", default) or write data program (ifmode"w").
local p = io.popen( "dir", "r" ) local output = p:read "*a" p:close( ) -- , use output
Comments
Post a Comment