Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 2009 14:17:34 -0500
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        Alexander Best <alexbestms@math.uni-muenster.de>
Cc:        rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org
Subject:   Re: c question: *printf'ing arrays
Message-ID:  <4A4A64CE.1030906@missouri.edu>
In-Reply-To: <permail-20090630182103f7e55a9d0000355c-a_best01@message-id.uni-muenster.de>
References:  <permail-20090630182103f7e55a9d0000355c-a_best01@message-id.uni-muenster.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Best wrote:
> thanks. now the output gets redirected using >. i'm quite new to programming
> under unix. sorry for the inconvenience.
> 
> so i guess there is no really easy way to output an inhomogeneous struct to
> stdout without using a loop to output each array contained in the struct.
> 
> cheers.

I think you are asking for a print command, that when given a structure, 
can look at the data type of each element of the structure, and produces 
the appropriate print command for each data type.

I think what you are asking for is antithetical to the philosophy of C - 
for example, the printf command demands that you tell the printf command 
what are the data types of the data you give to it.

So I think that the kind of long winded print command you are advocating 
is the correct way to do it.

Stephen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A4A64CE.1030906>