Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /* ヘッダファイルのインクルード */
  2. #include <stdio.h> /* 標準入出力 */
  3. #include <unistd.h> /* UNIX標準 */
  4. #include <sys/types.h> /* 派生型 */
  5. #include <sys/stat.h> /* ファイル状態 */
  6.  
  7. /* main関数 */
  8. int main(void){
  9.  
  10. /* 構造体の宣言 */
  11. struct stat sst; /* stat構造体変数sst */
  12. if (stat("test.txt", &sst) == 0){ /* statで"test.txt"のファイル情報を取得し, sstに格納.(0なら成功.) */
  13.  
  14. /* 取得できたら, 所有者のユーザーIDを出力. */
  15. printf("sst.st_uid = %lu\n", sst.st_uid); /* sst.st_uidを出力. */
  16.  
  17. }
  18.  
  19. /* プログラムの終了 */
  20. return 0; /* 0を返して正常終了. */
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement