memset( buffer, 1000, 0); strcat(buffer, first_text); strcat(buffer, second_text);
or does strcat not exist in stdlib anymore? I'm just returning to C/C++ after a 10 year stint in the (gag) .NET world. But I was a C programmer for 15 year before that. Hope my memory isn't as bad as I think it is! For Sale: Nice Parachute, Used Once, Never Opened, Slightly Stained Michael Comperchio [email protected] On Mar 5, 2009, at 3:24 AM, Paul Herring wrote: > On Thu, Mar 5, 2009 at 4:49 AM, Gaurav <[email protected]> > wrote: > > 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. > > Instead of passing in (buffer) to the second call for the address, > pass in (&buffer[strlen(buffer)]). > > Watch out for buffer overflows though. > > -- > PJH > > http://shabbleland.myminicity.com/ind > http://www.chavgangs.com/register.php?referer=9375 >
