Like Tree2Likes

Need help fixing segmentation fault

This is a discussion on Need help fixing segmentation fault within the C Programming forums, part of the General Programming Boards category; Originally Posted by Avenger625 I'm sorry...I somehow skipped it. I never wanted to disect/critisize his mistake....I'm really sorry!!! Not to ...

  1. #31
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Avenger625 View Post
    I'm sorry...I somehow skipped it. I never wanted to disect/critisize his mistake....I'm really sorry!!!
    Not to worry... we all make mistakes. The real trick is to learn from them.
    Avenger625 likes this.

  2. #32
    Registered User
    Join Date
    Feb 2011
    Posts
    52
    Quote Originally Posted by CommonTater View Post
    AND...
    Code:
    	while (fscanf(fp," %c %c %d", &stone_color[i], &column[i],&row[i]) == 3)
    ... the space between the %c and %d is necessary according to the file format you provided in your first message.
    No its NOT necessary but the space between the %c and %c is necessary according to the file format Robbie provided in his first message.
    [The space between the %c and %d may be given.]

    Stupid is as stupid does!

  3. #33
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Avenger625 View Post
    No its NOT necessary but the space between the %c and %c is necessary according to the file format Robbie provided in his first message.
    [The space between the %c and %d may be given.]

    Stupid is as stupid does!
    Excuse me... I actually tested the code here... trust me it IS necessary otherwise it would convert errors in the file leading to possible data corruption...

    Code:
    b A 1
    b B 4
    B b 1
    B C 2
    B C 3
    W A 3
    w A1 4    <--- should cause a loop exit!
    W B 3 
    W B 2
    Last edited by CommonTater; 09-11-2011 at 05:56 PM.

  4. #34
    Registered User
    Join Date
    Sep 2011
    Posts
    16
    Quote Originally Posted by CommonTater View Post
    Excuse me... I actually tested the code here... trust me it IS necessary otherwise it would convert errors in the file leading to possible data corruption...

    Code:
    b A 1
    b B 4
    B b 1
    B C 2
    B C 3
    W A 3
    w A1 4    <--- should cause a loop exit!
    W B 3 
    W B 2
    works fine for me without the space.

  5. #35
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Robbie View Post
    works fine for me without the space.
    Yes... with a perfect file... what part of "errors in the file" do you not understand?

  6. #36
    Registered User
    Join Date
    Sep 2011
    Posts
    16
    Quote Originally Posted by CommonTater View Post
    Yes... with a perfect file... what part of "errors in the file" do you not understand?
    The part that my ADD forced me to ignore.

  7. #37
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Robbie View Post
    The part that my ADD forced me to ignore.
    Nice excuse.

  8. #38
    Registered User
    Join Date
    Sep 2011
    Posts
    16
    Quote Originally Posted by CommonTater View Post
    Nice excuse.

  9. #39
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Robbie View Post
    The part that my ADD forced me to ignore.
    That's ** BEAUTIFUL ** Robbie! :ROFL!:

  10. #40
    Registered User
    Join Date
    Feb 2011
    Posts
    52

  11. #41
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Quote Originally Posted by Avenger625 View Post
    [..image..]
    You are aware that your output is flawed? There is no "w A 1" line in the input.

  12. #42
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by _Mike View Post
    You are aware that your output is flawed? There is no "w A 1" line in the input.
    Yeah there is... in the file he *actually* used... as opposed to the flawed one I suggested he test.

    He linked it at the top of his message...
    Avenger625 likes this.

  13. #43
    Registered User
    Join Date
    Feb 2011
    Posts
    52
    Not for argument....not for debate.....I just wanted to point..........

    Quote Originally Posted by Avenger625 View Post
    No its NOT necessary but the space between the %c and %c is necessary according to the file format Robbie provided in his first message.
    [The space between the %c and %d may be given.]

    Stupid is as stupid does!
    Thank You all!!! Good night....sorry good morning.....!!!
    Have a nice day everyone....take care.....bye...!!!

  14. #44
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Quote Originally Posted by CommonTater View Post
    Yeah there is... in the file he *actually* used... as opposed to the flawed one I suggested he test.

    He linked it at the top of his message...
    Oh, I assumed that was just a dump of the output.
    If that actually was the input then that's quite a lame attempt to "prove" someone wrong.

    Quote Originally Posted by Avenger625 View Post
    Not for argument....not for debate.....I just wanted to point..........

    No its NOT necessary but the space between the %c and %c is necessary according to the file format Robbie provided in his first message.
    [The space between the %c and %d may be given.]

    Stupid is as stupid does!
    So your point is that file corruption and/or input mistakes never happen so all input validation and error checking is basically useless?
    Last edited by _Mike; 09-11-2011 at 06:50 PM.

  15. #45
    Registered User
    Join Date
    Feb 2011
    Posts
    52
    I hate being rude.....but...........Are u really a nut??? When did i say or imply in anyway that error checking(s) are useless?! And, I'm unlike u, trying to prove someone wrong or prove myself superior than someone!! I have no such intentions. I'm here to discuss and enhance my knowledge and learn more. And in doing so, if can add value to the forum.
    Check the following......

    Quote Originally Posted by CommonTater View Post

    AND...
    Code:
    	while (fscanf(fp," %c %c %d", &stone_color[i], &column[i],&row[i]) == 3)
    ... the space between the %c and %d is necessary according to the file format you provided in your first message.

    But, once again... had you taken 5 minutes and read the documentation, you would have known that.

    Stupid is as stupid does!

Page 3 of 4 FirstFirst 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation Fault
    By tlman12 in forum C Programming
    Replies: 1
    Last Post: 10-29-2010, 04:57 PM
  2. Segmentation fault
    By Miffeltoffel in forum C Programming
    Replies: 8
    Last Post: 10-21-2010, 04:55 AM
  3. Re: Segmentation fault
    By turkish_van in forum C Programming
    Replies: 8
    Last Post: 01-20-2007, 05:50 PM
  4. Segmentation Fault
    By Haos in forum C Programming
    Replies: 2
    Last Post: 09-18-2004, 09:00 PM
  5. segmentation fault and memory fault
    By Unregistered in forum C Programming
    Replies: 12
    Last Post: 04-02-2002, 11:09 PM

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