美文网首页
iOS Lua 报错'system' is un

iOS Lua 报错'system' is un

作者: 冷煖自知 | 来源:发表于2018-03-09 18:00 被阅读992次

将loslib.c中
int stat = system(cmd);
改为
int stat = nftw(cmd, unlink_cb, 64, FTW_DEPTH | FTW_PHYS);
引入头文件
#include <ftw.h>
添加方法

int unlink_cb(const char *fpath, const struct stat *sb, int typeflag, struct FTW     *ftwbuf)
{
    int rv = remove(fpath);
    
    if (rv)
        perror(fpath);
    
    return rv;
}

听雨阁

相关文章

网友评论

      本文标题:iOS Lua 报错'system' is un

      本文链接:https://www.haomeiwen.com/subject/pnlmfftx.html