gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

template library or mailbox library for C


From: Pawel Kot
Subject: template library or mailbox library for C
Date: Mon, 15 Oct 2007 20:24:56 +0200

Hi,

Is there any good text template library for C? To be clear, I mean
library that would help me in the following situation:

I want to output (or rather return as char *) an SMS as an email in
mbox format. Straightforward way is:

sprintf(tmp, "From address@hidden %s", number, date);
strcat(buf, tmp);
sprintf(tmp, "From: address@hidden", number);
strcat(buf, tmp);
...

And all the ugly stuff wrt allocating memory.

Other solution I could think of is:
#define MAIL_TEMPLATE \
"From address@hidden %s" \
"From: address@hidden" \
....
sprintf(buf, MAIL_TEMPLATE, number, date, number, ...);

That's still ugly but somehow better. And allocating stuff is not that bad.

Is there any library that would allow me to create such email in an
easy way? Or more generic solution that would allow me to define a
template:
#define MAIL_TEMPLATE \
"From address@hidden %date%" \
"From: address@hidden" \

replace(buf, MAIL_TEMPLATE, number, date, ...);
that would do everything for me?

take care,
pkot
-- 
Pawel Kot




reply via email to

[Prev in Thread] Current Thread [Next in Thread]