String variable expansion routine wanted

Spiros Papadopoulos spap at avrolymos.com
Wed Jan 18 02:02:01 PST 2006


Hi,

Well If I understood well you need printf()
Definitely check the manual page:
#man 3 printf

You can use printf() like this:

vartype Variable = declaration;   /* string or int or double etc */

/* will print your text and the variable in the middle */
printf("some text... %type_of_variable ... more text", variable); 

You can use multiple variables like that if you want of any type:
int = 1;
string = "Hello";
....
....
.....
printf("(text)number: %i(int), text: %s, text: %..., text: %... , text:
...", int, string, ..., ..., ...);

Spiros P.

> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org [mailto:owner-freebsd-
> questions at freebsd.org] On Behalf Of Alexander Pohoyda
> Sent: Wednesday, January 18, 2006 9:46 AM
> To: freebsd-questions at freebsd.org
> Subject: String variable expansion routine wanted
> 
> Hi folks,
> 
> Is there a C-function that does string variable expansion like this:
> 
>     "some text $(VARIABLE) text" --> "some text VALUE text"
> 
> I suppose this functionality is useful for many programs, so I'm
> looking for a simpe library to link with.
> 
> Please CC me on reply.  Thanks a lot!
> 
> --
> Alexander Pohoyda <alexander.pohoyda at gmx.net>
> PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-
> unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list