Thread: Segment fault on double whammy char pointer

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > Well there is the whole learning experience too ya know.
    Yes, futility is a lesson I suppose - Like cutting the lawn with scissors.

    Another being recognising the best tool for the job.

  2. #17
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Thank you guys for all of that help! (Especially the shell script!). So i was working on Version 3 of the C programmed get Images program, and BAM! Segment fault, so I laughed at the screen thinking it would be incredibly easy for me to solve this sucker--it wasn't! I know where the segment fault is, & it is highlighted in the source of the txt file that I uploaded. free() just doesn't like to be free! :(.

    Could someone help me out with this segment fault?

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Boy, you sure go out of your way to make it difficult for people to help you.

    First you post bitmaps, then you ask people to download a text file.

    What's wrong with just pasting it directly into the message surrounded by [code][/code] tags?

    > ImagesList[Image_Number] = szImage;
    This should use
    Code:
    strcpy(ImagesList[Image_Number],szImage);
    > ImagesList = malloc(Image_Total * (sizeof ImagesList));
    Although it shouldn't be a problem for you, this should really be
    Code:
    ImagesList = malloc(Image_Total * (sizeof *ImagesList));
    Oh, and what's with all the C99/C++ embedded declarations?

  4. #19
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Quote Originally Posted by Salem
    What's wrong with just pasting it directly into the message surrounded by [code][/code] tags?
    Because I thought I had too many lines of code :(

    Quote Originally Posted by Salem
    Oh, and what's with all the C99/C++ embedded declarations?
    Experiments, Emmanuel Delaha put a {} block in one of his examples, I really like them!

    Now everything is complete! It's time to share all of this great work:

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help...
    By darkconvoy in forum C Programming
    Replies: 32
    Last Post: 04-29-2008, 03:33 PM
  2. Sorting Linked Lists
    By DKING89 in forum C Programming
    Replies: 6
    Last Post: 04-09-2008, 07:36 AM
  3. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  4. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 01:18 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM