Re: weird Linux+GCC problem

1998-03-22 Thread Fred Smith
On Sat, Mar 21, 1998 at 02:04:29AM -0500, Saad wrote: > I'm experiencing a problem with a C program. I am allocating two nodes > dynamically and creating a linked list. The problem is when I return from > the function, it gives me a segmentation fault. My code looks fine, and > it runs fine und

Re: weird Linux+GCC problem

1998-03-22 Thread Marius Aamodt Eriksen
This code even runs fine under DOS compiled /w BC++4.52... can't see any problems -Original Message- From: Saad <[EMAIL PROTECTED]> To: RedHat Mailing List <[EMAIL PROTECTED]> Date: Saturday, March 21, 1998 9:05 AM Subject: weird Linux+GCC problem >I'm experi

Re: weird Linux+GCC problem

1998-03-21 Thread Michael P. Plezbert
On Sat, 21 Mar 1998, David E. Fox wrote: > > The second argument to scanf in the line > > > > scanf("%s", &filename); > > > > needs to be a pointer to a char ARRAY large enough to hold the input. The > > way it is, you are overwriting memory. The fact that is works on digital > > unix is j

Re: weird Linux+GCC problem

1998-03-21 Thread David E. Fox
> The second argument to scanf in the line > > scanf("%s", &filename); > > needs to be a pointer to a char ARRAY large enough to hold the input. The > way it is, you are overwriting memory. The fact that is works on digital > unix is just a fluke. Not only that, if filename is defined as a

Re: weird Linux+GCC problem

1998-03-21 Thread Michael P. Plezbert
Umm, the problem is not with Linux or gcc, it's an error in your code. The second argument to scanf in the line scanf("%s", &filename); needs to be a pointer to a char ARRAY large enough to hold the input. The way it is, you are overwriting memory. The fact that is works on digital unix is

weird Linux+GCC problem

1998-03-21 Thread Saad
I'm experiencing a problem with a C program. I am allocating two nodes dynamically and creating a linked list. The problem is when I return from the function, it gives me a segmentation fault. My code looks fine, and it runs fine under digital unix. Do I have to do something different with lin