<分区>
这可能是一个菜鸟问题,但我什至不知道要用谷歌搜索什么。
我正在尝试实现一个融合文件系统,但在传递结构时遇到问题,这可能是因为我对 C++ 没有经验。
static int getStat(std::string path, struct stat *stout)
{
...
struct stat *st = new struct stat();
lstat(path.c_str(), st);
// lstat correctly filled st according to gdb
...
stout = st;
// values are correctly copied to stout according to gdb
}
void something()
{
struct stat *st = new struct stat(); // this might also be stack allocated by fuse, idk
getStat("/", st);
// but st is all zero now !?
}
我错过了什么?如何正确地从函数中获取数据?