memset the buffer to 0, after you store the previous value. get the length of the new string, chop off the null, add it in. Then add the other string in after that value using the length.
Thanks, Tyler Littlefield Web: tysdomain.com email: [email protected] My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: Gaurav To: [email protected] Sent: Wednesday, March 04, 2009 9:49 PM Subject: [c-prog] Strings Help Hey Hi, I have a char array (buffer[1000])... I accept a string from the user and store it in buffer[]...now I accept a new string and I want this string to b stored in the buffer[] but ahead of the previous string...how do i do that? eg: String1: "ABC" In buffer it will be stored as buffer[0] = "A" buffer[1] = "B" buffer[2] = "C" I now accept 2nd String... String2: "XYZ" I want this string to be stored ahead of ABC i.e as follows:- buffer[3] = "X" buffer[4] = "Y" buffer[5] = "Z" i.e when I print buffer it should print ABCXYZ and not just XYZ. Thank You! [Non-text portions of this message have been removed]
