MESSAGE
DATE | 2005-01-25 |
FROM | James Linder
|
SUBJECT | Re: [hangout] Simple C question
|
On Tuesday 25 January 2005 03:21 pm, Inker, Evan wrote: > Check this out > > strcopy.c > > .............. > > > If I have three strings: > char *str1; > char str2[]; > char str3[10]; > > how do I copy the info from str1 to str2? > > how do I copy the info from str1 to str3? (I imagine it is the same, and I > realize I will loose data if strlen(str1)>10)
Watch out using strcopy for copying str1 to str3. From what I understand it'll keep writing after the end of the str3 array. I think there is an nstrcopy() function you could use too that you can tell exactly how many elements to copy from one char array to another.
Jamey ____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|