Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #10779

fprintf internally supports print character array in hex?

From mathog <dmathog@gmail.com>
Newsgroups comp.lang.c
Subject fprintf internally supports print character array in hex?
Date 2011-09-23 10:23 -0700
Organization A noiseless patient Spider
Message-ID <j5ifbi$irm$1@dont-email.me> (permalink)

Show all headers | View raw


Consider this code snippet:

char buffer[128];
int  i,len;
   /* code that puts data in buffer and sets len */
for(i=0;i<len;i++){fprintf(stdout,"%x",buffer[i]);}

With the newer formatting options in fprintf (like "*" and "%m") can the 
for loop now be replaced with a single fprintf like:

    fprintf(stdout,"%????x",buffer,len);

where ???? is some combination of the newer format options.

Thanks,

David Mathog

Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

fprintf internally supports  print character array in hex? mathog <dmathog@gmail.com> - 2011-09-23 10:23 -0700
  Re: fprintf internally supports  print character array in hex? blp@cs.stanford.edu (Ben Pfaff) - 2011-09-23 10:32 -0700
    Re: fprintf internally supports  print character array in hex? mathog <dmathog@gmail.com> - 2011-09-23 10:38 -0700
  Re: fprintf internally supports  print character array in hex? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-23 18:47 +0100
    Re: fprintf internally supports  print character array in hex? mathog <dmathog@gmail.com> - 2011-09-23 12:45 -0700
      Re: fprintf internally supports  print character array in hex? blp@cs.stanford.edu (Ben Pfaff) - 2011-09-23 12:50 -0700
      Re: fprintf internally supports  print character array in hex? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-23 21:34 +0100
        Re: fprintf internally supports  print character array in hex? mathog <dmathog@gmail.com> - 2011-09-23 16:12 -0700
          Re: fprintf internally supports print character array in hex? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-30 01:06 -0700
          Re: fprintf internally supports  print character array in hex? "BartC" <bc@freeuk.com> - 2011-09-30 12:36 +0100
        Re: fprintf internally supports  print character array in hex? David Thompson <dave.thompson2@verizon.net> - 2011-10-03 01:11 -0400
    Re: fprintf internally supports  print character array in hex? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-29 21:41 +0000
  Re: fprintf internally supports print character array in hex? Gene <gene.ressler@gmail.com> - 2011-10-03 02:26 -0700

csiph-web