Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placeholder for ino_t [duplicate]

Tags:

c

linux

Anyone knows what is the placeholder for ino_t type? I'm trying to print it out using printf and have tried %d, %i, %s and others but not working.

printf( " file name = %s, i-node number=**%d**\n", direntp->d_name, direntp->d_ino);

warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘__ino_t’ [-Wformat]

Do assume my other codes are correct. Most examples only show how to print the name, but not the inode number. I have also searched many places.

Thanks in advance

like image 989
Newbie Avatar asked Dec 19 '22 23:12

Newbie


1 Answers

If you know the type is integral, you can cast it to unsigned long long, and use %llu.

printf( " file name = %s, i-node number=%llu\n",
       direntp->d_name, (unsigned long long)direntp->d_ino);
like image 182
jxh Avatar answered Jan 02 '23 03:01

jxh