Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jan 2006 09:58:08 -0000
From:      "Spiros Papadopoulos" <spap@avrolymos.com>
To:        "'Alexander Pohoyda'" <alexander.pohoyda@gmx.net>
Cc:        freebsd-questions@freebsd.org
Subject:   RE: String variable expansion routine wanted
Message-ID:  <200601181001.k0IA1qUH030662@smtp-los04.proxy.aol.com>
In-Reply-To: <200601180945.k0I9jZQt000486@oak.pohoyda.family>

next in thread | previous in thread | raw e-mail | index | archive | help
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@freebsd.org [mailto:owner-freebsd-
> questions@freebsd.org] On Behalf Of Alexander Pohoyda
> Sent: Wednesday, January 18, 2006 9:46 AM
> To: freebsd-questions@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@gmx.net>
> PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-
> unsubscribe@freebsd.org"




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