Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Location
    MA
    Posts
    4

    Question Unanswered: weird seg-fault errors

    I'm very confused. I'm writing a C program but keep getting segmentation faults when i get to the if-statement. the weirdest thing is that the program works if the statement ends up being true. i get the seg-faults when its false. here's the notorious if-statement:

    if ( !strncmp( text, "ATOM ", 5) && text[13] != 'H' ) {
    blah blah blah
    }

    thanks a lot to anyone who can help

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    How is text defined ? What are examples of text ? What is the example when it fails ? Have you tried to split the if statement into 2 if statements - this would possibly eliminate one of the conditionals as being the problem ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •