Originally Posted by
samf
Hey, at least check the fclose for any errors.
Variable names could be a little better.
What are gg, xx, yy, c1, c2, g1 supposed to contain? I'm not just talking about the datatypes like int or float, but what is gg? Is that a ticker symbol? Gary Glitter? Is g1 related to it?
I used to have a friend that did this sort of thing too. I'd find in his code names of people for variable names which was just as useless. But I wasn't too harsh on him since he wasn't a programmer by trade.
You may want to get into the habit of putting braces in all if statements regardless if there is only one line. One day you won't notice the lack of braces and you'll put in another command right after it and then you'll scratch your head wondering why the new command is executing everytime.
It would also be a good habit to log all error messages with meaningful messages to file with an appropriate time and date stamp prefixing every logged message. "Cant open output file" doesn't help me if I am looking at it at 3 AM. What happened? Was the disk full? Was it a permissions problem? What was the fopen error message? Use strerror and errno!!
It's obvious that you are the only one that works on this code as only the author would know what is going on.