Execution won't go past random line??

This is a discussion on Execution won't go past random line?? within the C Programming forums, part of the General Programming Boards category; Hello, I won't post my entire code because it is sufficiently long, but I was hoping somebody might have an ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    4

    Execution won't go past random line??

    Hello,

    I won't post my entire code because it is sufficiently long, but I was hoping somebody might have an idea as to why the following is happening:
    Code:
      if (state==3 && gpost<pID){
          hd = err;
          return hd;
        }
        printf("before HERE\n");
        /* HERE */
        printf("after HERE");
    Fairly uninteresting piece of code, but without further explanation of what's going on, I have the problem that upon reaching the line with the comment "HERE" that I placed above, my program stops and then nothing happens. So I was just wondering if there's any general reason an error like this could occur?

    Oh, and the return statement shouldn't have anything to do with it since the following printf (before HERE) gets printed.

    Thanks.

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,444
    Nothing wrong with the code you posted. We would need more to be sure. The best thing to do is post the smallest, compilable sample that produces the error.

    In the mean time, I'm going to guess there's a seg fault somewhere. Perhaps you're overflowing a buffer or writing to an invalid file handle. Not much else I can say without seeing more though.

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    4
    Ah yes, seg faults. Now that you mention it, I'm quite sure that is the issue, thanks for the quick response, you've put me back on track.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you help me about tolower() in file
    By nctar in forum C Programming
    Replies: 7
    Last Post: 05-12-2010, 10:04 AM
  2. C - Function that returns a random line from a file
    By ghostdlr in forum Linux Programming
    Replies: 1
    Last Post: 02-15-2010, 06:27 PM
  3. Using unix command line to sort random array
    By lostmyshadow in forum C Programming
    Replies: 4
    Last Post: 12-11-2007, 06:14 PM
  4. Trouble replacing line of file
    By Rpog in forum C Programming
    Replies: 4
    Last Post: 04-19-2004, 10:22 AM
  5. Random Line (pls comment)
    By sikamikaniko in forum C++ Programming
    Replies: 9
    Last Post: 03-16-2003, 01:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21