printf'ing a matrix

Posted by Flavius on Stack Overflow See other posts from Stack Overflow or by Flavius
Published on 2011-03-05T12:51:25Z Indexed on 2011/03/05 15:24 UTC
Read the original article Hit count: 153

Filed under:
|

I'm trying to implement an all-purpose function for printing 2D data. What I've come up with is:

int mprintf(FILE* f, char* fmt, void** data, size_t cols, size_t rows)

The challenge is determining how many bits to read at once from data, based on fmt.

The format fmt is going to be the stdlib's-specific format for printf() and alike.

Do you have any knowledge of already-existing features from stdlibc (GNU GCC C's) I could use to ease this up?

I try avoiding having to do it all manually, because I know "I am stupid" (I don't want to introduce stupid bugs). Thus, reusing code would be the bug-freest way.

Thanks

Addendum

I see there's a /usr/include/printf.h. Can't I use any of those functions to do it right and ease my job at the same time?

© Stack Overflow or respective owner

Related posts about c

    Related posts about glibc