B
beagle197
Folks,
What is a good way to print a standard 80 (or less) column of text
where the left side being a field name text, and right side being the
space padded value? e.g. "image_handle<space-padding>0xff". This is
useful for outputting many lines of aligned debugging data, making it
easier to read and track down bugs.
I have something like this:
/* gcc -W -Wall -o handle handle.c */
#include <stdio.h>
int main(void) {
int nArray[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int *handle = &nArray[0];
fprintf(stderr, " int_ptr 0x%x\n", (unsigned int) handle);
return 0;
}
Outputs :
int_ptr 0xbffffa70
Seems I could use some sprintf macros that computes the length, and
offsets with the approp number of spaces between the field value
pairs, but I wondered if anyone has suggestions.
Thanks,
BEA
What is a good way to print a standard 80 (or less) column of text
where the left side being a field name text, and right side being the
space padded value? e.g. "image_handle<space-padding>0xff". This is
useful for outputting many lines of aligned debugging data, making it
easier to read and track down bugs.
I have something like this:
/* gcc -W -Wall -o handle handle.c */
#include <stdio.h>
int main(void) {
int nArray[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int *handle = &nArray[0];
fprintf(stderr, " int_ptr 0x%x\n", (unsigned int) handle);
return 0;
}
Outputs :
int_ptr 0xbffffa70
Seems I could use some sprintf macros that computes the length, and
offsets with the approp number of spaces between the field value
pairs, but I wondered if anyone has suggestions.
Thanks,
BEA