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
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Phil Sent: Wednesday, April 15, 1998 9:01 PM To: debian-user@lists.debian.org Subject: strcpy HELP I'm using libc6 2.0.7pre1-4 and strcpy gives me a segmentation error! I've attached my C test program for inspection(source

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

strcpy HELP!!!!

1998-04-16 Thread Phil
I'm using libc6 2.0.7pre1-4 and strcpy gives me a segmentation error! I've attached my C test program for inspection(source only). I only do a few things. malloc memory for a variable(forgot a corresponding free) copy a string in this varible, copy this string to another string, print both on the