[cs631apue] humanize_number

Aubhik Mazumdar amazumda at stevens.edu
Wed Oct 10 00:13:32 EDT 2018


Sorry for asking prematurely. I got it working using the decimal flag. Hope
it helps.

 void

 print_bytes(off_t fileSize,struct opts_holder opts){

     char bytes[5];

     int64_t actual_size = (int64_t)fileSize;

     char * suffix = "";

     if(opts._h){

         if(humanize_number(bytes,5,actual_size,suffix,HN_AUTOSCALE,HN_DECIMAL
| HN_NOSPACE | HN_B)==-1){

             printf("%7ld ",fileSize);

         } else

             (void)printf("%5s ",bytes);

     } else {

         (void)printf("%7ld ",fileSize);

     }

 };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20181010/a8a234e0/attachment.html>


More information about the cs631apue mailing list