0

I am checking process in linux c++, i use lstat to check filesize, please see this:

#include "sys/stat.h"
#include <iostream>
using namespace std;

int main() {
  std::string s = "/proc/23233/cmdline";  // 23233 is the pid
  struct stat sb;
  lstat(s.c_str(), &sb);
  cout << sb.st_size;
}

the output is:

0

cmdline is not empty, it record my command: ./a.out

but the size is 0, could you help on this?

nothingisme
  • 119
  • 5

0 Answers0