Thread: Problems with my loop in C(crashes itself)

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    55

    Problems with my loop in C(crashes itself)

    I have created a program that loops in C, but when I make into a large scale loop that has to get 1000's of lines of data to print to a file it crashes. I'm not sure how I can fix this, but it might could be done with a time delay. I have not used time delays before, and I have no idea why my program might actually be crashing other than just the overwhelming amount of data. Anyone help me?

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Posting some code may help
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by BatchProgrammer View Post
    I have created a program that loops in C, but when I make into a large scale loop that has to get 1000's of lines of data to print to a file it crashes. I'm not sure how I can fix this, but it might could be done with a time delay. I have not used time delays before, and I have no idea why my program might actually be crashing other than just the overwhelming amount of data. Anyone help me?

    So it works with a loop of smaller amounts? It could be anything really. Is the file opened and closed correctly?

  4. #4
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    It might be that an array is going out of bounds.

    How big is the file? How large are the buffers which you are reading into?
    Fact - Beethoven wrote his first symphony in C

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Time has nothing to do with it, only correctness. We cant see how to correct your code without seeing your code.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 09-24-2010, 01:09 AM
  2. Program crashes when a loop is meant to begin
    By m88g88 in forum C Programming
    Replies: 21
    Last Post: 02-20-2010, 02:38 PM
  3. Loop crashes program
    By Akkernight in forum C++ Programming
    Replies: 12
    Last Post: 01-22-2009, 01:58 PM
  4. Loop crashes
    By mrtilley in forum C Programming
    Replies: 8
    Last Post: 10-19-2007, 07:30 AM
  5. loop crashes programme
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 10-09-2001, 06:51 PM