On Mon, 18 Aug 2003 12:22:27 -0700, Abby wrote:
Sorry to ask another silly question. After above, I need to
concatenate another string characters to "p". How can I do that? I
tried to use strncpy, but it didn't work. I think I really miss
concept about data type. Please help me figure this thing out.
What I need to do is
[snip ... ]
As you should have been able to work our from what was said to you
before, you can use something like...
char buf[128]; /* This _needs_ to be big enough */
/* so assume we test it with the largest s possible */
assert(((strlen(s) * 2) + 8) < sizeof(buf));
sprintf(buf,
"%s"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%s",
s,
session[0], session[1], session[2], session[3],
id[0], id[1], id[2], id[3],
s);
....which will do what you want, however I'd recommend you take a deeper
look into how pointers and memory work in C ... and also look at using a
real dynamically allocated string type. See...
http://www.and.org/vstr/security.html http://www.and.org/vstr/comparison.html
--
James Antill --
ja***@and.org
Need an efficent and powerful string library for C?
http://www.and.org/vstr/