0

I have a program which processes thousands of chemical structures. To keep track of how many are being processed, and to avoid staring at a blinking cursor for minutes not knowing if anything is happening, I included a simple bit of code:

if((MOLNUMBER%10000)==0)
{
     fprintf(stderr,".");
}

What could possibly go wrong? Well when it reached entry 200999 it bombed out with a segmentation fault. Thinking it could be the structure there I cut it out and repeated it. This time it bombed out on entry 240999. These were suspiciously round numbers so I decided to cut out this bit of code and the program worked fine, albeit with just a blinking cursor. I'm curious to know why this might be. Haven't included any other code as I can't see how it could clash, unless anyone thinks differently. Why would this code cause a seg fault?

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by edbarker
0

How is MOLNUMBER defined?

it is an integer (int MOLNUMBER;), which as a variable i use globally i put it in capitals (probably not good practice) I don't #define it as a constant. It is set after reading the molecule's entry number from the file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.