[lug] An unusual C construct
Zan Lynx
zlynx at acm.org
Tue Sep 21 20:50:05 MDT 2010
On 9/21/10 8:39 PM, Anthony Foiani wrote:
> [catching up on weeks ... er, months ... of posts...]
>
> Bear Giles<bgiles at coyotesong.com> writes:
>> I've used it all the time with things like
>>
>> sprintf(sizeof(tbl->name), "%s", tbl->name);
>
> And just in case someone runs across this in the archive, that looks
> like an odd call to 'sprintf'. Maybe just:
>
> printf( "sizeof( %s ) = %u\n", "tblp->name", sizeof( tblp->name ) );
>
I think what he must have meant there is:
snprintf(tbl->name, sizeof(tbl->name), "%s", new_name);
That would make a lot more sense to me.
--
Zan Lynx
zlynx at acm.org
"Knowledge is Power. Power Corrupts. Study Hard. Be Evil."
More information about the LUG
mailing list