[cs631apue] Size of large ints

Paul-Anthony Dudzinski pdudzins at stevens.edu
Sun Oct 13 17:06:37 EDT 2013


Hey all,
I am looking for a good way to measure the size of a large integer for
instance when I run my program on /tmp I get:

pdudzins at gits:~/cs631/midterm$ ./a.out -l /tmp

drwxrwxrwx  2 root     root          4096 .X11-unix
-rw-------  1 jschauma professor    10724 1
drwxr-xr-x  3 swatts   student       4096 VisualGDB
*-rw-------  1 jschauma professor 2097152000 big*
-rwxr-xr-x  1 swatts   student         56 dump-gdb-settings
-rw-r--r--  1 jschauma professor     2041 f
-rw-------  1 jschauma professor     2041 file
drwxr-xr-x  2 jsexton  student       4096 hsperfdata_jsexton
drwxr-xr-x  2 lxiong   student       4096 hsperfdata_lxiong
drwxr-xr-x  2 snatara1 student       4096 hsperfdata_snatara1
-rw-------  1 fcannava professor      611 krb5cc_11084_S26665
-rw-------  1 jrisi    student        605 krb5cc_11492_u17070
-rw-------  1 pdudzins student        611 krb5cc_11909_Iq7884
drwx------  2 jschauma professor     4096 ssh-OkXFz27774


And the bolded line is messing up my column print lengh. When I measure the
size of the size I am doing it like this:

        nlen_size =  sizeof(a->fts_statp->st_size);
        if (nlen_size > len_size)
                len_size = nlen_size;

And I keep getting 8 instead of 10 which I am pretty sure the 8 bytes it
takes to store an int...

Has anyone tried casting this as a character array and taking the size that
way? Is there a library function that will just do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20131013/70f3ba50/attachment.html>


More information about the cs631apue mailing list