Re: strcpy HELP!!!

1998-04-17 Thread Alex Yukhimets
> Scott D. Killen writes: > > You are copying the string to temp2 which has not been initialized and is a > > NULL pointer. You need to allocate memory of at least the same size as > > temp1 to temp2 and > > this will solve your problem. > > When using C library string functions always allocate m

Re: strcpy HELP!!!

1998-04-17 Thread E.L. Meijer \(Eric\)
Lee Brinton: > Scott D. Killen writes: > > You are copying the string to temp2 which has not been initialized and is > a > > NULL pointer. You need to allocate memory of at least the same size as > > temp1 to temp2 and > > this will solve your problem. > > When using C library string functions al

RE: strcpy HELP!!!

1998-04-17 Thread Scott D. Killen
-BEGIN PGP SIGNED MESSAGE- You are correct. I was making specific assumptions based on the code snippet shown. - -Original Message- From: Lee Brinton [mailto:[EMAIL PROTECTED] Sent: Friday, April 17, 1998 12:40 AM To: debian-user Mailing List Subject: RE: strcpy HELP!!! Scott

RE: strcpy HELP!!!

1998-04-17 Thread Lee Brinton
Scott D. Killen writes: > You are copying the string to temp2 which has not been initialized and is a > NULL pointer. You need to allocate memory of at least the same size as > temp1 to temp2 and > this will solve your problem. When using C library string functions always allocate memory of at l

RE: strcpy HELP!!!!

1998-04-17 Thread Scott D. Killen
Phil, You are copying the string to temp2 which has not been initialized and is a NULL pointer. You need to allocate memory of at least the same size as temp1 to temp2 and this will solve your problem. Scott D. Killen Scott Killen Software http://www.skillsoft.com -Original Message- Fro

Re: strcpy HELP!!!!

1998-04-17 Thread aqy6633
> #include > #include > #include > > void main(void) > { > char *temp1, *temp2; > temp1 = malloc (10); > strcpy (temp1, "high all"); > strcpy (temp2, temp1); > printf("%s %s", temp1, temp2); > } > /* error --- program recieved signal SIGSEGV, Segmentation Fault. > * 0x40050

Re: strcpy HELP!!!!

1998-04-17 Thread Ben Pfaff
This is your fault. You need to allocate memory for temp2. void main(void) { char *temp1, *temp2; temp1 = malloc (10); insert `temp2 = malloc (10);' here. strcpy (temp1, "high all"); strcpy (temp2, temp1); printf("%s %s", temp1, temp2); } -- To UNSUBS