当前位置:网站首页>[luat-air105] 4.1 file system FS
[luat-air105] 4.1 file system FS
2022-07-05 03:27:00 【Birds hate fish】
1 Preface
Try to air105 Create files under the root directory of and read and write
2 Code
t4_fs_info.lua
function get_fs_info()
log.info("fsize", fs.fsize("/luadb/main.luac"))
log.info("fsstat", fs.fsstat(""))
log.info("fsstat", fs.fsstat("/luadb/")) -- Be careful not to use "/luadb", To add a slash
end
-- Record startup times
function fs_test()
f = io.open("/boot_time", "rb")
c = 0
if f then
data = f:read("*a")
log.info("fs", "data", data, data:toHex())
c = tonumber(data)
f:close()
end
log.info("fs", "boot count", c)
c = c + 1
f = io.open("/boot_time", "wb")
--if f ~= nil then
log.info("fs", "write c to file", c, tostring(c))
f:write(tostring(c))
f:close()
--end
if fs then
log.info("fsstat", fs.fsstat(""))
end
end
function t4_fs_root_write()
print("init")
-- f = io.mkfs("youkai")
f = io.open("/youkai", "wb")
print(type(f))
--if f ~= nil then
c = "hi,langzhao"
log.info("fs", "write c to file", c)
f:write(tostring(c))
f:close()
f = io.open("/youkai", "r")
if f then
data = f:read("*a") -- *a Said file ,l Said line
-- https://gitee.com/openLuat/LuatOS/blob/master/lua/src/loslib.c g_read()
print("file data : ",data)
f:close()
end
-- air 105 root directory "" You can create files and read and write
end
-- LuaTools need PROJECT and VERSION These two messages
PROJECT = "fsdemo"
VERSION = "1.0.0"
log.info("main", PROJECT, VERSION)
-- sys The library is standard
_G.sys = require("sys")
require("t4_fs_info")
-- Add a hard dog to prevent the program from getting stuck
wdt.init(15000)-- initialization watchdog Set to 15s
sys.timerLoopStart(wdt.feed, 10000)--10s Feed the dog once
get_fs_info()
sys.taskInit(function()
-- Every time you turn it on , Record the value +1
fs_test()
t4_fs_root_write()
while 1 do
sys.wait(500)
end
end)
-- User code ended ---------------------------------------------
-- The end is always this sentence
sys.run()
-- sys.run() Don't add any statements after !!!!!
3 result
边栏推荐
- Une question est de savoir si Flink SQL CDC peut définir le parallélisme. Si le parallélisme est supérieur à 1, il y aura un problème d'ordre?
- Daily question 2 12
- LeetCode 237. Delete nodes in the linked list
- 平台入驻与独立部署优缺点对比
- In MySQL Association query, the foreign key is null. What if the data cannot be found?
- GFS distributed file system
- Acwing第 58 场周赛【完结】
- SFTP cannot connect to the server # yyds dry goods inventory #
- Voice chip wt2003h4 B008 single chip to realize the quick design of intelligent doorbell scheme
- Returns the lowest common ancestor of two nodes in a binary tree
猜你喜欢
Asemi rectifier bridge 2w10 parameters, 2w10 specifications, 2w10 characteristics
C file in keil cannot be compiled
[groovy] string (string splicing | multi line string)
Linux安装Redis
Yyds dry goods inventory intelligent fan based on CC2530 design
Leetcode92. reverse linked list II
Single box check box
[system security] ten thousand words summary system virtualization container bottom layer principle experiment
Pat class a 1160 forever (class B 1104 forever)
Easy processing of ten-year futures and stock market data -- Application of tdengine in Tongxinyuan fund
随机推荐
SQL injection exercise -- sqli Labs
Eight days of learning C language - while loop (embedded) (single chip microcomputer)
[groovy] loop control (number injection function implements loop | times function | upto function | downto function | step function | closure can be written outside as the final parameter)
C file in keil cannot be compiled
Leetcode42. connect rainwater
Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
Necessary fonts for designers
College Students' innovation project management system
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
Accuracy problem and solution of BigDecimal
Machine learning experiment report 1 - linear model, decision tree, neural network part
Six stone programming: advantages of automated testing
Good documentation
2021 Li Hongyi machine learning (2): pytorch
Cette ADB MySQL prend - elle en charge SQL Server?
[deep learning] deep learning reference materials
Sqoop安装
Pat grade a 1119 pre- and post order traversals (30 points)
Azkaban概述
FBO and RBO disappeared in webgpu