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 just a fluke.

   Michael

On Sat, 21 Mar 1998, 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 under digital unix.  Do I have to do something different with
> linux when using dynamic memory?  I've attached my code if someone would
> look at it.  Thanks for the help.

---------------------------------------------------------------------
DISCLAIMER: All opinions expressed herein are my own and should not
be construed to represent those of Washington University or any other
organization.
---------------------------------------------------------------------
Michael P. Plezbert                             [EMAIL PROTECTED]
Graduate Student                   http://www.cs.wustl.edu/~plezbert/
Department of Computer Science
Washington University in St. Louis



-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.

Reply via email to